| 815 | //收取地下随机零件电力API |
| 816 | |
| 817 | function PickUpComponent(index, encryptPin) { |
| 818 | return new Promise(resolve => { |
| 819 | $.get(taskurl('usermaterial/PickUpComponent', `placeId=${index}&pin=${encryptPin}`, `_time,pin,placeId,zone`), (err, resp, data) => { |
| 820 | try { |
| 821 | if (err) { |
| 822 | console.log(`${JSON.stringify(err)}`) |
| 823 | console.log(`${$.name} API请求失败,请检查网路重试`) |
| 824 | } else { |
| 825 | if (safeGet(data)) { |
| 826 | data = JSON.parse(data); |
| 827 | // if (data['ret'] === 0) { |
| 828 | // data = data['data']; |
| 829 | // if (help) { |
| 830 | // console.log(`收取好友[${encryptPin}]零件成功:获得${data['increaseElectric']}电力\n`); |
| 831 | // $.pickFriendEle += data['increaseElectric']; |
| 832 | // } else { |
| 833 | // console.log(`收取自家零件成功:获得${data['increaseElectric']}电力\n`); |
| 834 | // $.pickEle += data['increaseElectric']; |
| 835 | // } |
| 836 | // } else { |
| 837 | // if (help) { |
| 838 | // console.log(`收好友[${encryptPin}]零件失败:${JSON.stringify(data)}`) |
| 839 | // } else { |
| 840 | // console.log(`收零件失败:${JSON.stringify(data)}`) |
| 841 | // } |
| 842 | // } |
| 843 | } |
| 844 | } |
| 845 | } catch (e) { |
| 846 | $.logErr(e, resp) |
| 847 | } finally { |
| 848 | resolve(data); |
| 849 | } |
| 850 | }) |
| 851 | }) |
| 852 | } |
| 853 | //偷好友的电力 |
| 854 | async function stealFriend() { |
| 855 | // if (!$.pickUpMyselfComponent) { |