| 786 | } |
| 787 | } |
| 788 | function GetUserComponent(pin = $.encryptPin, timeout = 0) { |
| 789 | return new Promise(resolve => { |
| 790 | setTimeout(() => { |
| 791 | $.get(taskurl('usermaterial/GetUserComponent', `pin=${pin}`, `_time,pin,zone`), (err, resp, data) => { |
| 792 | try { |
| 793 | if (err) { |
| 794 | console.log(`${JSON.stringify(err)}`) |
| 795 | console.log(`${$.name} API请求失败,请检查网路重试`) |
| 796 | } else { |
| 797 | if (safeGet(data)) { |
| 798 | data = JSON.parse(data); |
| 799 | if (data['ret'] === 0) { |
| 800 | |
| 801 | } else { |
| 802 | console.log(`GetUserComponent失败:${JSON.stringify(data)}`) |
| 803 | } |
| 804 | } |
| 805 | } |
| 806 | } catch (e) { |
| 807 | $.logErr(e, resp) |
| 808 | } finally { |
| 809 | resolve(data); |
| 810 | } |
| 811 | }) |
| 812 | }, timeout) |
| 813 | }) |
| 814 | } |
| 815 | //收取地下随机零件电力API |
| 816 | |
| 817 | function PickUpComponent(index, encryptPin) { |