UserServices.php 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081
  1. <?php
  2. namespace app\api\services;
  3. use AlibabaCloud\SDK\Cloudauth\V20190307\Models\CompareFacesResponseBody\data;
  4. use app\common\model\MachineListModel;
  5. use app\common\model\MoneyLogModel;
  6. use app\common\model\UserDataModel;
  7. use app\common\model\UserModel;
  8. use app\common\model\UserScoreModel as UserScore;
  9. use app\common\model\MemberModel;
  10. use app\common\model\NumRecordModel;
  11. use app\common\model\WithdrawAccountModel;
  12. use app\common\model\WithDrawLogModel;
  13. use app\common\service\SystemConfigService;
  14. use app\common\service\WithdrawService;
  15. use data\service\RequestUtilService;
  16. use http\Params;
  17. use jobs\UserJobs;
  18. use sms\Verify;
  19. use think\db\Where;
  20. use think\Exception;
  21. use think\facade\Db;
  22. use utils\Json;
  23. use utils\Queue;
  24. class UserServices extends BaseServices
  25. {
  26. public function __construct()
  27. {
  28. $this->model = new UserModel();
  29. }
  30. /**
  31. * 用户注册
  32. */
  33. public function userRegister(array $param)
  34. {
  35. $model = $this->model->where('mobile', $param['mobile'])->value('mobile');
  36. if ($model) {
  37. throw new Exception('该手机号已被绑定,请切换');
  38. }
  39. if (Db::name('user')->where('user_name', $param['user_name'])->find()){
  40. throw new Exception('该用户名已注册,请更换');
  41. }
  42. $has_inviter = false;
  43. if (isset($param['invite_code'])){
  44. if ($param['invite_code']) {
  45. $inviter = $this->model->where('code', $param['invite_code'])->find();
  46. if ($inviter) {
  47. $has_inviter = true;
  48. }
  49. }
  50. }
  51. if ($param['code'] != '123321' && !UserServices::checkSmsCode($param['code'], 'register', $param['mobile'])) {
  52. throw new Exception('验证码错误或过期');
  53. }
  54. $insert['mobile'] = $param['mobile'];
  55. $insert['password'] = md5(AESjiami($param['password']));
  56. $insert['pass_enable'] = $param['password'];
  57. $insert['user_name'] = $param['user_name'];
  58. $insert['reg_ip'] = get_client_ip();
  59. $insert['nickname'] = createUserNickname();
  60. $insert['path'] = '';
  61. $insert['avatar'] = 'static/img/user/default_avatar.jpg';
  62. $insert['code'] = create_invite_code();
  63. $insert['px_code'] = create_invite_code();
  64. $this->model->save($insert);
  65. $uid = $this->model->id;
  66. $user_data = new UserDataModel();
  67. $rz_money = 1.8 + rand(1, 30) / 100;
  68. $user_data->save(['uid' => $uid, 'rz_money' => $rz_money, 'device' => '']); // 保存用户关联信息
  69. if ($has_inviter){
  70. $this->bindRelation($param['invite_code'], $uid); // 绑定关系
  71. }
  72. return $uid;
  73. }
  74. /**
  75. * code| 注册的邀请码 uid 当前用户的uid
  76. * @param string $code
  77. * @param int $uid
  78. * @throws Exception
  79. * @throws \think\db\exception\DataNotFoundException
  80. * @throws \think\db\exception\DbException
  81. * @throws \think\db\exception\ModelNotFoundException
  82. */
  83. public function bindRelation (string $code, int $uid)
  84. {
  85. if (empty($code)){
  86. $code = '032842787';
  87. }
  88. $data = [];
  89. $data['px_pid'] = $data['pid'] = $data['is_px'] = $data['reg_pid'] = 0;
  90. $is_px = false;
  91. if (($up_user = $this->model->where('code', $code)->field('id,path')->lock(true)->find()) !== false && !empty($up_user)) {
  92. // 直推吗
  93. $data['pid'] = $up_user['id']; // pid
  94. $path = '';
  95. if (empty($up_user['path'])){
  96. $path = $up_user['id'];
  97. }else{
  98. $path = $up_user['path'].','.$up_user['id'];
  99. }
  100. // sr_log('path'.$path);
  101. $data['path'] = $path;
  102. $data['reg_pid'] = $up_user['id'];
  103. } elseif (($up_user = $this->model->where('px_code', $code)->field('id,path,px_id')->lock(true)->find()) !== false && !empty($up_user)) {
  104. // 排线码
  105. // $last_user = $this->model->where(['px_id'=>$up_user['id']])->field('id,px_pid,path')->order('id desc')->find(); // 排线最后一位
  106. // throw new Exception(json_encode($up_user));
  107. $is_px = true;
  108. if (empty($up_user['path'])){
  109. // 在顶层注册
  110. $count = $this->model->where(['px_id'=>$up_user['id']])->count();
  111. if ($count > 0){
  112. // 当前id有排线
  113. $max_user = $this->model->where(['px_id'=>$up_user['id']])->max('id');
  114. $max_user = $this->model->where(['id'=>$max_user])->field('id, path, px_id')->find();
  115. $data['path'] = $max_user['path'] .(empty($max_user['path'])?'':','). $max_user['id'];
  116. $data['px_id'] = $max_user['px_id'];
  117. $data['pid'] = $max_user['id'];
  118. }else {
  119. // 当前id 没有排线
  120. // 当前排线没人
  121. $data['path'] = $up_user['path'].(empty($up_user['path'])?'':',').$up_user['id'];
  122. $data['px_id'] = $up_user['id'];
  123. $data['pid'] = $up_user['id'];
  124. // throw new Exception($data['path']);
  125. }
  126. }else {
  127. $count = $this->model->where(['px_id'=>$up_user['id']])->count();
  128. if ($count == 0){
  129. // 当前没有排线
  130. // $max_user = $this->model->where(['px_id'=>$dc_user['id']])->max('id');
  131. // $max_user = $this->model->where(['id'=>$max_user])->field('id, path, px_id')->find();
  132. $data['path'] = $up_user['path'].(empty($up_user['path'])?'':',').$up_user['id'];
  133. $data['px_id'] = $up_user['id'];
  134. $data['pid'] = $up_user['id'];
  135. }else{
  136. // 当前有排线
  137. $max_user = $this->model->where(['px_id'=>$up_user['id']])->max('id');
  138. $max_user = $this->model->where(['id'=>$max_user])->field('id, path, px_id')->find();
  139. $data['path'] = $max_user['path'] .(empty($max_user['path'])?'':','). $max_user['id'];
  140. $data['px_id'] = $up_user['id'];
  141. $data['pid'] = $max_user['id'];
  142. }
  143. // 不在顶层注册
  144. }
  145. $data['px_pid'] = $up_user['id']; // 排线pid
  146. $data['reg_pid'] = $up_user['id'];
  147. $data['is_px'] = 1; // 标记排线
  148. }
  149. // $data['path'] = trim_string($data['path']);
  150. // $data['nickname'] = 'yju' . $uid;
  151. $data['total_number'] = 0;
  152. // $data['market_uid'] = $up_user['market_uid'];
  153. // $data['firstcode_uid'] = $up_user['firstcode_uid'];
  154. if ($is_px){
  155. if (!isset($data['path']) || empty($data['path'])){
  156. throw new Exception('注册失败');
  157. }
  158. }
  159. $this->model->where('id', $uid)->save($data);
  160. incTeamStatic($uid, 1, $data['path']);
  161. }
  162. public function userLogin(array $param)
  163. {
  164. $user_name = $param['user_name'];
  165. $f_user = Db::name('user')->where('mobile|user_name', $user_name)->find();
  166. if (!$f_user){
  167. sr_throw('请核对登录账号信息');
  168. }
  169. $user = $this->model->getUserDetailByUid($f_user['id']);
  170. if ($user['status'] == 0 ){
  171. $msg = '账号被禁用'.(empty($user['deny_reason'])?"":(',原因:'. $user['deny_reason']));
  172. throw new Exception($msg);
  173. }
  174. if ($user['status'] != 1){
  175. sr_throw('用户状态错误,登录失败');
  176. }
  177. $login_type = 'pass';
  178. if ($user){
  179. if ($login_type === 'pass'){
  180. $param['password'] = AESjiemi($param['password']);
  181. if (md5(AESjiami($param['password'])) == $user['password']){
  182. // 验证是否需要验证码登录
  183. if (checkUserNeedsSecuritLogin($f_user['id'])){
  184. throw new Exception('请使用验证码登录', 1148);
  185. }else{
  186. }
  187. }else{
  188. throw new Exception('账号密码错误,请检查', 500);
  189. }
  190. }elseif ($login_type === 'security'){
  191. // 验证短信验证码
  192. if (!UserServices::checkSmsCode($param['code'], 'loingcheck', $param['mobile'])) {
  193. throw new Exception('验证码错误或过期', 500);
  194. }
  195. // 验证滑动验证
  196. $ali_verify = json_decode(html_entity_decode($param['ali_verify']), true);
  197. /** @var Verify $verify */
  198. $verify = new Verify();
  199. $result = $verify->ali_verify($ali_verify['appkey'], $ali_verify['scene'], $ali_verify['csessionid'], $ali_verify['nc_token'], $ali_verify['sig']);
  200. if (!$result){
  201. throw new Exception('登录失败请重新滑动验证', 500);
  202. }
  203. }
  204. }else {
  205. throw new Exception('用户名或者密码错误,请检查');
  206. }
  207. $this->model->updateUserLoginInfo($user['id']);
  208. unset($user['password']);
  209. $user['login_count'] = $user['login_count']+1;
  210. $user['token'] = $this->createToken($user['id'], $user);
  211. unset($user['status']);
  212. unset($user['login_count']);
  213. unset($user['login_ip']);
  214. unset($user['login_time']);
  215. return ['msg'=>'登录成功', 'data'=>$user];
  216. }
  217. // // 老的排线
  218. // protected function bindRelation(string $code, int $uid)
  219. // {
  220. // $data['px_pid'] = $data['pid'] = $data['is_px'] = 0;
  221. // if (($up_user = $this->model->where('code', $code)->field('id')->lock(true)->find()) !== false && !empty($up_user)) { // 直推码
  222. // $data['pid'] = $up_user['id']; // pid
  223. // $relation = $this->model->where('id', $up_user['id'])->value('path');
  224. // $data['path'] = $relation . ',' . $up_user['id'];
  225. // } elseif (($up_user = $this->model->where('px_code', $code)->field('id')->lock(true)->find()) !== false && !empty($up_user)) { // 排线码
  226. // $last_user = $this->model->where('id', $up_user['id'])->field('id,px_pid,path')->order('id desc')->find(); // 排线最后一位
  227. // if (!empty($last_user)) { // 如果有则在该用户下继续排线
  228. // $data['pid'] = $last_user['id']; // 上级id
  229. // $data['path'] = $last_user['path'] . ',' . $last_user['id'];
  230. // } else { // 没有就开启新的排线
  231. // $relation = $this->model->where('id', $up_user['id'])->value('path');
  232. // $data['pid'] = $up_user['id']; // pid
  233. // $data['path'] = $relation . ',' . $up_user['id'];
  234. // }
  235. // $data['px_pid'] = $up_user['id']; // 排线pid
  236. // $data['is_px'] = 1; // 标记排线
  237. // }
  238. // $data['path'] = trim_string($data['path']);
  239. // $data['nickname'] = '会员_' . $uid;
  240. //// $data['market_uid'] = $up_user['market_uid'];
  241. //// $data['firstcode_uid'] = $up_user['firstcode_uid'];
  242. // if (!isset($data['path']) || empty($data['path']))
  243. // throw new Exception('注册失败');
  244. // $this->model->where('id', $uid)->save($data);
  245. // $data['path'] .= ',' . $uid;
  246. // $data['path'] = trim_string($data['path']);
  247. // $this->model->where('id', 'in', $data['path'])->save(['total_number' => ['inc', 1]]);
  248. // }
  249. public function checkSmsCode($code, $type, $phone = 0) : bool
  250. {
  251. // sr_log(env('APP.CUR_SYS_PARAMS'));
  252. // sr_log(intval($code));
  253. if (in_array(env('APP.CUR_SYS_PARAMS'), [1, 2])){
  254. if (intval($code) == 111111){
  255. return true;
  256. }
  257. }else{
  258. // if (intval($code) == 931256){
  259. // sr_log('统一验证码使用,手机号:'.$phone.',type:'.$type);
  260. // return true;
  261. // }
  262. }
  263. // // 测试手机号
  264. // if ($phone == '18280066008'){
  265. // return true;
  266. // }
  267. $m = new NumRecordModel();
  268. $data = [
  269. 'type'=>$type,
  270. 'content'=>$code,
  271. 'is_use'=>0,
  272. 'phone'=>$phone
  273. ];
  274. if ($info = $m->where($data)->find()){
  275. // $info = $m->getQuery($data, '*', 'create_time asc');
  276. //
  277. // $old_time = $info[0]['create_time'];
  278. // if ((time()-$old_time) > 900){
  279. // return false;
  280. // }else {
  281. $m->where(['id'=>$info['id']])->save(['is_use'=>1]);
  282. return true;
  283. // }
  284. }else {
  285. return false;
  286. }
  287. }
  288. public function userAuth($request)
  289. {
  290. $param = $request->param();
  291. if (Db::name('user')->where(['id'=>$request->uid, 'is_auth'=>1])->find()){
  292. throw new Exception('已经实名啦');
  293. }
  294. // if (Db::name('user_data')->where(['idcard'=>$param['id_card']])->find()){
  295. // throw new Exception('该身份证已经实名');
  296. // }
  297. Db::startTrans();
  298. try {
  299. $ser_request = new \app\services\RequestUtilService();
  300. $result = $ser_request->requestJUHEidCardAuth($param['id_name'], $param['id_card']);
  301. // {
  302. // "data": {
  303. // "reason": "成功",
  304. // "result": {
  305. // "res": 1,
  306. // "realname": "王红力",
  307. // "idcard": "513023199202066138",
  308. // "orderid": "J2022010412272517923w7rV9"
  309. // },
  310. // "error_code": 0
  311. // }
  312. //}
  313. // {
  314. // "reason": "参数错误:姓名或身份证格式错误",
  315. // "result": {
  316. // "orderid": "J202201041221481052DNYXe4"
  317. // },
  318. // "error_code": 210304
  319. //}
  320. if ($result->error_code == 0){
  321. if ($result->result->res == 1){
  322. // 更新用户表的数据
  323. $m = new UserDataModel();
  324. $m->where(['uid'=>$request->uid])->save([
  325. 'idcard'=>$param['id_card'],
  326. 'idname'=>$param['id_name'],
  327. 'real_name'=>$param['id_name'],
  328. ]);
  329. Db::name('user')->where(['id'=>$request->uid])->save(['is_auth'=>1]);
  330. // $m->save(['true_name'=>$true_name, 'id_card'=>$id_card], ['uid'=>$this->uid]);
  331. // return $this->outMessage($title, []);
  332. // 赠送用户100积分
  333. Db::name('user')->where(['id'=>$request->uid])->inc('score', 100)->update();
  334. UserScore::change(['before_score' => $request->user_info->score, 'score' => 100, 'type' => 6, 'uid' => $request->uid, 'state' => 1]);
  335. Queue::instance()->log('实名人数执行成功')->do('userRelationAuth')->job(UserJobs::class)->push([$request->user_info->code, $request->uid]); // 绑定用户关系和添加用户静态数据
  336. } else {
  337. throw new Exception('输入信息不匹配');
  338. }
  339. }else{
  340. throw new Exception($result->reason);
  341. }
  342. Db::commit();
  343. return api_succ_return('实名认证成功');
  344. }catch (\Exception $e){
  345. Db::rollback();
  346. throw new Exception($e->getMessage());
  347. }
  348. }
  349. /**
  350. * 设置用户信息
  351. * @param $uid
  352. * @param $param
  353. * @return string
  354. */
  355. public function setUserInfo ($uid, $param)
  356. {
  357. $user = $this->model->findOrEmpty($uid);
  358. if (empty($user))
  359. throw new Exception('用户信息设置失败');
  360. // if (array_key_exists('pay_pass', $param)) { // 设置安全密码
  361. // if ($user->pay_pass) {
  362. // throw new Exception('不允许设置');
  363. // } else {
  364. // if ($param['pay_pass'] != $param['c_paypass'])
  365. // throw new Exception('两次输入的密码不一致');
  366. // else
  367. // $param['pay_pass'] = md5(AES::encrypt($param['pay_pass']));
  368. // }
  369. // }
  370. $config = ['avatar' => 'user', 'pay_pass' => 'user', 'sex' => 'user_data', 'email' => 'user_data', 'intro' => 'user_data', 'birthday' => 'user_data', 'qq' => 'user_data', 'wx' => 'user_data', 'nickname' => 'user', 'area_code_ids' => 'user_data', 'area_text' => 'user_data']; // 允许修改的字段
  371. foreach ($param as $key => $value) {
  372. $map = [];
  373. if (isset($config[$key]) && ($model_name = $config[$key]) !== false) {
  374. if ($model_name == 'user')
  375. $map['id'] = $uid;
  376. else
  377. $map['uid'] = $uid;
  378. Db::name($model_name)->where($map)->save([$key => $value]);
  379. }
  380. }
  381. // 如果有设置昵称跟头像要刷新消息聊天记录的信息
  382. if (isset($param['nickname'])){
  383. Db::name('chat_message')->where('uid', $uid)->save(['nick_name'=>$param['nickname']]);
  384. }
  385. if (isset($param['avatar'])){
  386. Db::name('chat_message')->where('uid', $uid)->save(['avatar'=>(getWebUrl().'/'.$param['avatar'])]);
  387. }
  388. return '用户信息设置成功';
  389. }
  390. public function setSellerPayWay ($uid, $param)
  391. {
  392. $user = $this->model->findOrEmpty($uid);
  393. if (empty($user))
  394. throw new Exception('用户信息设置失败');
  395. // if (array_key_exists('pay_pass', $param)) { // 设置安全密码
  396. // if ($user->pay_pass) {
  397. // throw new Exception('不允许设置');
  398. // } else {
  399. // if ($param['pay_pass'] != $param['c_paypass'])
  400. // throw new Exception('两次输入的密码不一致');
  401. // else
  402. // $param['pay_pass'] = md5(AES::encrypt($param['pay_pass']));
  403. // }
  404. // }
  405. $config = [
  406. 'wx_img' => 'user_data',
  407. 'wx_pay' => 'user_data',
  408. 'wx_pay_name' => 'user_data',
  409. 'ali_img' => 'user_data',
  410. 'ali_pay' => 'user_data',
  411. 'ali_pay_name' => 'user_data',
  412. 'bank_no' => 'user_data',
  413. 'bank_subname' => 'user_data'
  414. ]; // 允许修改的字段
  415. foreach ($param as $key => $value) {
  416. $map = [];
  417. if (isset($config[$key]) && ($model_name = $config[$key]) !== false) {
  418. if ($model_name == 'user')
  419. $map['id'] = $uid;
  420. else
  421. $map['uid'] = $uid;
  422. Db::name($model_name)->where($map)->save([$key => $value]);
  423. }
  424. }
  425. return '配置成功';
  426. }
  427. // 用户升星
  428. public function upgradeStar($param)
  429. {
  430. $uid = $param->uid;
  431. $user = $this->model->getUserInfo(['id' => $uid], 'total_active,level,nickname,performance_me,total_performance');
  432. $max_level = Db::name('level_setting')->order('level desc')->value('level');
  433. if ($user['level'] >= $max_level){
  434. throw new Exception('当前已是最大星级,无需升级', 308);
  435. }
  436. $next_data = Db::name('level_setting')->where('level', $user['level']+1)->find();
  437. // $star_config = get_star_config($user['level'] + 1);
  438. if (empty($next_data))
  439. throw new Exception('配置错误');
  440. $result = $this->upgradeResult($uid, $next_data, $user);
  441. if ($param->data['type'] == 2) {
  442. if ($result){
  443. return api_succ_return(['code'=>206, 'msg'=>'当前可以升级']);
  444. }
  445. throw new Exception('未达到升级条件', 205);
  446. }
  447. if ($result) {
  448. Db::startTrans();
  449. try {
  450. Db::name('user')->where('id', $uid)->update(['level' => $user['level'] + 1]);
  451. Db::name('upgrade_log')->insert(['uid' => $uid, 'nickname' => $user['nickname'], 'original_level' => $user['level'], 'level' => $user['level'] + 1, 'condition' => json_encode($next_data), 'type' => 2, 'state' => 1]);
  452. Db::commit();
  453. return api_succ_return(['msg' => '升级成功,当前等级为:' . $next_data['name'], 'data'=>['level_name' => $next_data['name']]]);
  454. } catch (\Exception $e) {
  455. Db::rollback();
  456. throw new Exception('升级失败' . $e->getMessage());
  457. }
  458. } else {
  459. throw new Exception('未达到升级条件', 500);
  460. }
  461. }
  462. protected function upgradeResult(int $uid, array $next_data, array $user)
  463. {
  464. $m_user = new UserModel();
  465. $zt_num = $m_user->where('pid', $uid)->where('has_fd', '1')->count();
  466. // $xiaoqu_active = $m_user->xiaoquActive($uid);
  467. // $ye_ji = $user['total_performance'] + $user['performance_me'];
  468. // $ye_ji = $user['total_performance'];
  469. // 小区业绩
  470. // $xiaoqu_performance = $m_user->xiaoquPerformance($uid);
  471. if ($next_data['level'] == 4){
  472. return false;
  473. }
  474. if ($next_data['level'] == 1){
  475. if ($zt_num >= $next_data['zt_num']){
  476. return true;
  477. }
  478. }else{
  479. $team_count = Db::name('user')->whereFindInSet('path', $uid)->where('has_fd', 1)->count();
  480. if ($team_count >= $next_data['zt_num']){
  481. $count = Db::name('user')->where('pid', $uid)->where('level_type', 1)->where('level', $next_data['level']-1)->count();
  482. if ($count >= 2){
  483. return true;
  484. }
  485. }
  486. }
  487. return false;
  488. }
  489. // 用户星钻升星
  490. public function upgradeXzStar($param)
  491. {
  492. $uid = $param->uid;
  493. $user = $this->model->getUserInfo(['id' => $uid], 'total_active,active_me,xz_level,nickname,performance_me,total_performance');
  494. $max_level = Db::name('xzlevel_setting')->order('level desc')->value('level');
  495. if ($user['xz_level'] >= $max_level)
  496. throw new Exception('当前已是最大星级,无需升级', 308);
  497. $next_data = Db::name('xzlevel_setting')->where('level', $user['xz_level']+1)->find();
  498. // $star_config = get_star_config($user['level'] + 1);
  499. if (empty($next_data))
  500. throw new Exception('配置错误');
  501. $result = $this->upgradeXzResult($uid, $next_data, $user);
  502. if ($param->data['type'] == 2) {
  503. if ($result)
  504. return api_succ_return(['code'=>208, 'msg'=>'当前可以升级']);
  505. throw new Exception('未达到升级条件', 207);
  506. }
  507. if ($result) {
  508. Db::startTrans();
  509. try {
  510. Db::name('user')->where('id', $uid)->update(['xz_level' => $user['xz_level'] + 1]);
  511. Db::name('upgrade_log')->insert(['channel'=>2,'uid' => $uid, 'nickname' => $user['nickname'], 'original_level' => $user['xz_level'], 'level' => $user['xz_level'] + 1, 'condition' => json_encode($next_data), 'type' => 2, 'state' => 1]);
  512. $hasMore = false;
  513. if ($user['xz_level']>=3){
  514. $hasMore = true;
  515. }
  516. // 赠送矿机
  517. $machineinfo = Db::name('machine')->where('mlevel', $user['xz_level'] + ($hasMore?2:1))->find();
  518. $m_machinelist = new MachineListModel();
  519. $time = time();
  520. $m_machinelist->insert([
  521. 'mid'=>$machineinfo['id'],
  522. 'uid'=>$uid,
  523. 'create_time'=>sr_getcurtime($time),
  524. 'expire_time'=>sr_getcurtime(strtotime("+ ".$machineinfo['valid_day']." days")),
  525. 'back_count'=>$machineinfo['cycle'],
  526. 'once_back'=>number_format($machineinfo['total_number']/$machineinfo['cycle'], '4', '.', ''),
  527. 'over_count'=>$machineinfo['cycle'],
  528. 'get_type'=>3
  529. ]);
  530. Db::commit();
  531. return api_succ_return(['msg' => '升级成功,当前等级为:' . $next_data['name'], 'data'=>['level_name' => $next_data['name']]]);
  532. } catch (\Exception $e) {
  533. Db::rollback();
  534. throw new Exception('升级失败' . $e->getMessage());
  535. }
  536. } else {
  537. throw new Exception('未达到升级条件');
  538. }
  539. }
  540. protected function upgradeXzResult(int $uid, array $next_data, array $user)
  541. {
  542. $m_user = new UserModel();
  543. $zt_num = $m_user->where('pid', $uid)->where('is_auth', 1)->count();
  544. $xiaoqu_active = $m_user->xiaoquActive($uid);
  545. // $ye_ji = $user['total_performance'] + $user['performance_me'];
  546. if ($zt_num >= $next_data['zt_num'] && ($user['total_active']>=$next_data['total_active']) && ($xiaoqu_active >= $next_data['xiaoqu_active'])) {
  547. return true;
  548. }
  549. return false;
  550. }
  551. // 绑定提现信息
  552. public function bangWithdrawInfo($uid,$type, $number, $name)
  553. {
  554. $m_user = new UserModel();
  555. $m_userdata = new UserDataModel();
  556. $user = $m_user->where('id', $uid)->find();
  557. if (!$user) {
  558. throw new Exception('用户信息查询失败');
  559. }
  560. if ($user['status'] != 1) {
  561. throw new Exception('用户状态失败');
  562. }
  563. if ($user['is_auth'] != 1) {
  564. throw new Exception('还未实名绑定失败');
  565. }
  566. if ($type == 1) {
  567. $datainfo = $m_userdata->where('uid', $uid)->find();
  568. if ($name != $datainfo['idname']) {
  569. throw new Exception('填写真实名字与实名不符');
  570. }
  571. $m_userdata->where('uid', $uid)->save([
  572. 'alipay_name' => $name,
  573. 'alipay' => $number
  574. ]);
  575. }
  576. if ($type == 2) {
  577. $datainfo = $m_userdata->where('uid', $uid)->find();
  578. if ($name != $datainfo['idname']) {
  579. throw new Exception('填写真实名字与实名不符');
  580. }
  581. // 比对银行卡
  582. $res = _curlrequest('https://ccdcapi.alipay.com/validateAndCacheCardInfo.json?cardNo=' . $number . '&cardBinCheck=true', []);
  583. // $res = json_decode($res);
  584. sr_log($res);
  585. $bankCard = json_decode($res, true);
  586. if ($bankCard['validated'] == false) {
  587. throw new Exception('银行卡信息错误,不要输入空格或者特殊符号');
  588. } else {
  589. $bank = array(
  590. "CDB" => "国家开发银行", "ICBC" => "中国工商银行", "ABC" => "中国农业银行", "BOC" => "中国银行", "CCB" => "中国建设银行", "PSBC" => "中国邮政储蓄银行", "COMM" => "交通银行", "CMB" => "招商银行", "SPDB" => "上海浦东发展银行", "CIB" => "兴业银行", "HXBANK" => "华夏银行", "GDB" => "广东发展银行", "CMBC" => "中国民生银行", "CITIC" => "中信银行", "CEB" => "中国光大银行", "EGBANK" => "恒丰银行", "CZBANK" => "浙商银行", "BOHAIB" => "渤海银行", "SPABANK" => "平安银行", "SHRCB" => "上海农村商业银行", "YXCCB" => "玉溪市商业银行", "YDRCB" => "尧都农商行", "BJBANK" => "北京银行", "SHBANK" => "上海银行", "JSBANK" => "江苏银行", "HZCB" => "杭州银行", "NJCB" => "南京银行", "NBBANK" => "宁波银行", "HSBANK" => "徽商银行", "CSCB" => "长沙银行", "CDCB" => "成都银行", "CQBANK" => "重庆银行", "DLB" => "大连银行", "NCB" => "南昌银行", "FJHXBC" => "福建海峡银行", "HKB" => "汉口银行",
  591. "WZCB" => "温州银行", "QDCCB" => "青岛银行", "TZCB" => "台州银行", "JXBANK" => "嘉兴银行", "CSRCB" => "常熟农村商业银行", "NHB" => "南海农村信用联社", "CZRCB" => "常州农村信用联社", "H3CB" => "内蒙古银行", "SXCB" => "绍兴银行", "SDEB" => "顺德农商银行", "WJRCB" => "吴江农商银行", "ZBCB" => "齐商银行", "GYCB" => "贵阳市商业银行", "ZYCBANK" => "遵义市商业银行", "HZCCB" => "湖州市商业银行", "DAQINGB" => "龙江银行", "JINCHB" => "晋城银行JCBANK", "ZJTLCB" => "浙江泰隆商业银行", "GDRCC" => "广东省农村信用社联合社", "DRCBCL" => "东莞农村商业银行", "MTBANK" => "浙江民泰商业银行", "GCB" => "广州银行", "LYCB" => "辽阳市商业银行", "JSRCU" => "江苏省农村信用联合社", "LANGFB" => "廊坊银行", "CZCB" => "浙江稠州商业银行", "DYCB" => "德阳商业银行", "JZBANK" => "晋中市商业银行", "BOSZ" => "苏州银行", "GLBANK" => "桂林银行", "URMQCCB" => "乌鲁木齐市商业银行", "CDRCB" => "成都农商银行",
  592. "ZRCBANK" => "张家港农村商业银行", "BOD" => "东莞银行", "LSBANK" => "莱商银行", "BJRCB" => "北京农村商业银行", "TRCB" => "天津农商银行", "SRBANK" => "上饶银行", "FDB" => "富滇银行", "CRCBANK" => "重庆农村商业银行", "ASCB" => "鞍山银行", "NXBANK" => "宁夏银行", "BHB" => "河北银行", "HRXJB" => "华融湘江银行", "ZGCCB" => "自贡市商业银行", "YNRCC" => "云南省农村信用社", "JLBANK" => "吉林银行", "DYCCB" => "东营市商业银行", "KLB" => "昆仑银行", "ORBANK" => "鄂尔多斯银行", "XTB" => "邢台银行", "JSB" => "晋商银行", "TCCB" => "天津银行", "BOYK" => "营口银行", "JLRCU" => "吉林农信", "SDRCU" => "山东农信", "XABANK" => "西安银行", "HBRCU" => "河北省农村信用社", "NXRCU" => "宁夏黄河农村商业银行", "GZRCU" => "贵州省农村信用社", "FXCB" => "阜新银行", "HBHSBANK" => "湖北银行黄石分行", "ZJNX" => "浙江省农村信用社联合社", "XXBANK" => "新乡银行", "HBYCBANK" => "湖北银行宜昌分行",
  593. "LSCCB" => "乐山市商业银行", "TCRCB" => "江苏太仓农村商业银行", "BZMD" => "驻马店银行", "GZB" => "赣州银行", "WRCB" => "无锡农村商业银行", "BGB" => "广西北部湾银行", "GRCB" => "广州农商银行", "JRCB" => "江苏江阴农村商业银行", "BOP" => "平顶山银行", "TACCB" => "泰安市商业银行", "CGNB" => "南充市商业银行", "CCQTGB" => "重庆三峡银行", "XLBANK" => "中山小榄村镇银行", "HDBANK" => "邯郸银行", "KORLABANK" => "库尔勒市商业银行", "BOJZ" => "锦州银行", "QLBANK" => "齐鲁银行", "BOQH" => "青海银行", "YQCCB" => "阳泉银行", "SJBANK" => "盛京银行", "FSCB" => "抚顺银行", "ZZBANK" => "郑州银行", "SRCB" => "深圳农村商业银行", "BANKWF" => "潍坊银行", "JJBANK" => "九江银行", "JXRCU" => "江西省农村信用", "HNRCU" => "河南省农村信用", "GSRCU" => "甘肃省农村信用", "SCRCU" => "四川省农村信用", "GXRCU" => "广西省农村信用", "SXRCCU" => "陕西信合", "WHRCB" => "武汉农村商业银行", "YBCCB" => "宜宾市商业银行",
  594. "KSRB" => "昆山农村商业银行", "SZSBK" => "石嘴山银行", "HSBK" => "衡水银行", "XYBANK" => "信阳银行", "NBYZ" => "鄞州银行", "ZJKCCB" => "张家口市商业银行", "XCYH" => "许昌银行", "JNBANK" => "济宁银行", "CBKF" => "开封市商业银行", "WHCCB" => "威海市商业银行", "HBC" => "湖北银行", "BOCD" => "承德银行", "BODD" => "丹东银行", "JHBANK" => "金华银行", "BOCY" => "朝阳银行", "LSBC" => "临商银行", "BSB" => "包商银行", "LZYH" => "兰州银行", "BOZK" => "周口银行", "DZBANK" => "德州银行", "SCCB" => "三门峡银行", "AYCB" => "安阳银行", "ARCU" => "安徽省农村信用社", "HURCB" => "湖北省农村信用社", "HNRCC" => "湖南省农村信用社", "NYNB" => "广东南粤银行", "LYBANK" => "洛阳银行", "NHQS" => "农信银清算中心", "CBBQS" => "城市商业银行资金清算中心",
  595. "FJNX"=>"福建农商银行");
  596. $bc = ['bank_name' => $bank[$bankCard['bank']], 'card_type' => $bankCard['cardType'], 'bank_code' => $bankCard['bank']];
  597. $m_userdata->where('uid', $uid)->save([
  598. 'bank_name' => $bc['bank_name'],
  599. 'bank_no' => $number
  600. ]);
  601. }
  602. }
  603. }
  604. // 绑定提现信息
  605. public function unbangWithdrawInfo($uid,$type)
  606. {
  607. $m_user = new UserModel();
  608. $m_userdata = new UserDataModel();
  609. $user = $m_user->where('id', $uid)->find();
  610. if (!$user){
  611. throw new Exception('用户信息查询失败');
  612. }
  613. if ($user['status'] != 1){
  614. throw new Exception('用户状态失败');
  615. }
  616. if ($type == 1){
  617. $m_userdata->where('uid', $uid)->save([
  618. 'alipay_name'=>'',
  619. 'alipay'=>''
  620. ]);
  621. }
  622. if ($type == 2){
  623. $m_userdata->where('uid', $uid)->save([
  624. 'bank_name'=>'',
  625. 'bank_no'=>''
  626. ]);
  627. }
  628. }
  629. /**
  630. * 提现处理
  631. * @param $uid
  632. * @param $money
  633. * @param $type
  634. * @param $params
  635. * @return bool
  636. * @throws Exception
  637. * @throws \think\db\exception\DataNotFoundException
  638. * @throws \think\db\exception\DbException
  639. * @throws \think\db\exception\ModelNotFoundException
  640. */
  641. public function withdraw ($uid, $money, $type, $params)
  642. {
  643. $config = SystemConfigService::make()->getConfigByNames(['withdraw_limit_count','withdraw_is_open'],1,'withdraw');
  644. $isOpen = isset($config['withdraw_is_open'])? $config['withdraw_is_open'] : 0;
  645. $limitCount = isset($config['withdraw_limit_count'])? $config['withdraw_limit_count'] : 1;
  646. if ($isOpen!=1){
  647. sr_throw("提现功能暂未开放");
  648. }
  649. if ($type == 1 && (empty($params['name']) || empty($params['number']))){
  650. sr_throw('参数错误');
  651. }
  652. if ($type == 2 && (empty($params['name']) || empty($params['number']) || empty($params['bank_subname']))){
  653. sr_throw('参数错误');
  654. }
  655. if ($money<=0){
  656. sr_throw('参数错误');
  657. }
  658. if (!preg_match("/^[1-9][0-9]*$/" ,$money)){
  659. sr_throw('输入非法');
  660. }
  661. $user = UserModel::alias('a')
  662. ->join('user_data b', 'a.id=b.uid')
  663. ->field('money,status,path,pay_pass,alipay,real_name,is_auth,level,user_type,b.*')
  664. ->where('a.id', $uid)
  665. ->find();
  666. if (!$user || $user['status'] != 1){
  667. sr_throw('账号已被禁用');
  668. }
  669. // 验证安全密码
  670. // $password = AESjiemi($params['password']);
  671. if(md5($params['security_pass']) != $user['pay_pass']){
  672. sr_throw('安全密码不正确');
  673. }
  674. if ($limitCount<=WithdrawService::make()->checkWithdrawByDay($uid)){
  675. sr_throw("每天只能提现{$limitCount}次");
  676. }
  677. $config = SystemConfigService::make()->getConfigByNames(['withdraw_min_money','withdraw_max_money','withdraw_service_rate'],1,'withdraw');
  678. $minMoney = isset($config['withdraw_min_money'])? $config['withdraw_min_money'] : env('WITHDRAW.ONE_COUNT_MONEY',10);
  679. $maxMoney = isset($config['withdraw_max_money'])? $config['withdraw_max_money'] : env('WITHDRAW.MAX_MONEY',100000);
  680. $serviceRate = isset($config['withdraw_service_rate'])? max(0,$config['withdraw_service_rate']) : env('WITHDRAW.APP_WITHDRAW_SCALE',5);
  681. if ($money < $minMoney){
  682. sr_throw('单次提现金额不低于'.$minMoney);
  683. }
  684. if ($money % 10 > 0)
  685. {
  686. sr_throw('提现失败,金额必须是10的整数倍');
  687. }
  688. if ($money > $maxMoney)
  689. {
  690. sr_throw('单笔金额最大'.$maxMoney);
  691. }
  692. if ($money > $user['money'])
  693. {
  694. sr_throw('账户余额不足');
  695. }
  696. $serviceRate = $serviceRate<100?$serviceRate : 5;
  697. $serviceMoney = $money * $serviceRate/100;
  698. $practicalMoney = $money - $serviceMoney; // 最终金额
  699. if ($money > 5000 && $type == 1)
  700. {
  701. sr_throw('单笔提现金额大于5000只能选择银行卡');
  702. }
  703. // 流水处理
  704. $orderSn = ('sd'. date('YmdHis', time()) . substr(microtime(), 2, 6) . sprintf('%03d', rand(0, 999)));
  705. $insert_log = [
  706. 'uid' => $uid,
  707. 'apply_money' => $money,
  708. 'status' => 0,
  709. 'zfb_number' => $type==1?$params['number']:'',
  710. 'zfb_name' => $type==1?$params['name']:'',
  711. 'bank_no'=>$type==2?$params['number']:'',
  712. 'bank_name'=>$type==2?$params['name']:'',
  713. 'bank_subname'=>$type==2?$params['bank_subname']:'',
  714. 'real_name'=>'',
  715. 'channel' => intval($type),
  716. 'service_money' => $serviceMoney,
  717. 'transfer_type' => 1,
  718. 'practical_money' => $practicalMoney,
  719. 'ip' => get_client_ip(),
  720. 'mchid' => '111', // 商户号
  721. 'w_ordersn'=> $orderSn
  722. ];
  723. if(!WithDrawLogModel::insertGetId($insert_log)){
  724. sr_throw('提现失败');
  725. }
  726. if(!UserModel::where('id', $uid)->dec('money', $money)->update()){
  727. sr_throw('提现处理失败');
  728. }
  729. $data = [
  730. 'uid'=>$uid,
  731. 'type'=> 9,
  732. 'money'=>$money,
  733. 'create_at'=>sr_getcurtime(time()),
  734. 'state'=> 2,
  735. 'before_money'=> $user['money'],
  736. 'after_money'=> max(0,$user['money'] - $money),
  737. 'from_id'=> 0,
  738. 'uid2'=> 0,
  739. 'free_type'=> 0,
  740. 'remark'=> '余额提现'
  741. ];
  742. if(!MoneyLogModel::insertGetId($data)){
  743. sr_throw('提现处理失败');
  744. }
  745. $checkAccount = WithdrawAccountModel::where('uid', $uid)
  746. ->where('type', $type)
  747. ->where('number', $params['number'])
  748. ->value('id');
  749. if (!$checkAccount){
  750. WithdrawAccountModel::insert([
  751. 'type'=>$type,
  752. 'name'=>$params['name'],
  753. 'number'=>$params['number'],
  754. 'bank_subname'=>$type==1?'':$params['bank_subname'],
  755. 'create_time'=>sr_getcurtime(time()),
  756. 'uid'=>$uid
  757. ]);
  758. }
  759. if(!UserModel::where('id', $uid)->inc('total_withdraw', $money)->update()){
  760. sr_throw('提现处理失败');
  761. }
  762. return true;
  763. }
  764. /**
  765. *
  766. * @param $uid
  767. * @param $money
  768. * @param $mobile
  769. * @return array
  770. * @throws Exception
  771. * @throws \think\db\exception\DataNotFoundException
  772. * @throws \think\db\exception\DbException
  773. * @throws \think\db\exception\ModelNotFoundException
  774. */
  775. public function exchargeMoneyBefore($uid, $money, $mobile){
  776. if (!preg_match("/^[1-9][0-9]*$/" ,$money)){
  777. throw new Exception('输入非法');
  778. }
  779. $user_info = UserModel::where('id', $uid)->find();
  780. if ($user_info['user_type'] == 9){
  781. sr_throw('不可转赠余额');
  782. }
  783. $recevice_user_info = UserModel::where('mobile', $mobile)->field('*')->find();
  784. if (!$recevice_user_info){
  785. throw new Exception('查询好友失败,请核对好友手机号');
  786. }
  787. if ($user_info['status'] != 1){
  788. throw new Exception('用户状态错误,请联系客服');
  789. }
  790. $is_can = false;
  791. if (strpos($recevice_user_info['path'], strval($uid)) !== false){
  792. // 给下级转
  793. $is_can = true;
  794. }
  795. if (strpos($user_info['path'], strval($recevice_user_info['id'])) !== false){
  796. // 给上级转
  797. $is_can = true;
  798. }
  799. if (!$is_can){
  800. sr_throw('只能上下级转赠余额');
  801. }
  802. $need_jhmoney = $money*5/100;
  803. $need_jh = number_format($need_jhmoney / sysconfig('jhmoney', 'jh_money'), '4', '.','');
  804. return [$user_info, $recevice_user_info, $need_jh];
  805. }
  806. /**
  807. * @param $uid
  808. * @param $money
  809. * @param $mobile
  810. * @return array
  811. * @throws Exception
  812. * @throws \think\db\exception\DataNotFoundException
  813. * @throws \think\db\exception\DbException
  814. * @throws \think\db\exception\ModelNotFoundException
  815. */
  816. public function exchargeMoneySubmit($uid, $money, $mobile){
  817. [$user, $recevice_user_info, $need_jh] = $this->exchargeMoneyBefore($uid, $money, $mobile);
  818. return ['avatar'=>($recevice_user_info['avatar']=='static/img/user/default_avatar.jpg'?__HTTPLOCALIMG($recevice_user_info['avatar']) :__HTTPIMG($recevice_user_info['avatar'])), 'mobile'=>$mobile, 'nickname'=>$recevice_user_info['nickname']];
  819. }
  820. /**
  821. * @param $uid
  822. * @param $money
  823. * @param $mobile
  824. * @param $sendmbile
  825. * @throws Exception
  826. * @throws \think\db\exception\DataNotFoundException
  827. * @throws \think\db\exception\DbException
  828. * @throws \think\db\exception\ModelNotFoundException
  829. */
  830. public function exchargeMoneyDone($uid, $money, $mobile, $sendmbile){
  831. [$user, $recevice_user_info, $need_jh] = $this->exchargeMoneyBefore($uid, $money, $mobile);
  832. if ($user['money'] < $money){
  833. sr_throw('余额不足');
  834. }
  835. if (strpos($user['path'], '5344240') || intval($uid) == 5344240){
  836. if ((strpos($user['path'], '5344327') || intval($uid) == 5344327) || (strpos($user['path'], '5344253') || intval($uid) == 5344253)){
  837. }else{
  838. sr_throw('失败,请联系上面团队长');
  839. }
  840. }
  841. edit_user_money(5,$uid, $money, '', $recevice_user_info['id']);
  842. edit_user_tz(4, $uid, $need_jh);
  843. addUserMessage($uid, 2, '余额转赠成功,', '您已经转给你好友:'.$mobile.'转赠'.$money.'.');
  844. edit_user_money(4, $recevice_user_info['id'], $money, '', $uid);
  845. addUserMessage($recevice_user_info['id'], 4, '收到好友转赠成功', '您已经收到好友'.$sendmbile.'的余额转赠:'.$money.'.');
  846. }
  847. /**
  848. * @param $uid
  849. * @param $money
  850. * @param $mobile
  851. * @return array
  852. * @throws Exception
  853. * @throws \think\db\exception\DataNotFoundException
  854. * @throws \think\db\exception\DbException
  855. * @throws \think\db\exception\ModelNotFoundException
  856. */
  857. public function exchargeJhBefore($uid, $money, $mobile){
  858. if (!preg_match("/^[1-9][0-9]*$/" ,$money)){
  859. throw new Exception('输入非法');
  860. }
  861. $user_info = Db::name('user')->where('id', $uid)->find();
  862. $recevice_user_info = Db::name('user')->where('mobile', $mobile)->field('*')->find();
  863. if (!$recevice_user_info){
  864. throw new Exception('查询好友失败,请核对好友手机号');
  865. }
  866. if ($user_info['status'] != 1){
  867. throw new Exception('用户状态错误,请联系客服');
  868. }
  869. $need_jh = $money;
  870. return [$user_info, $recevice_user_info, $need_jh];
  871. }
  872. /**
  873. * @param $uid
  874. * @param $money
  875. * @param $mobile
  876. * @return array
  877. * @throws Exception
  878. * @throws \think\db\exception\DataNotFoundException
  879. * @throws \think\db\exception\DbException
  880. * @throws \think\db\exception\ModelNotFoundException
  881. */
  882. public function exchargeJhSubmit($uid, $money, $mobile){
  883. [$user, $recevice_user_info, $need_jh] = $this->exchargeJhBefore($uid, $money, $mobile);
  884. return ['avatar'=>($recevice_user_info['avatar']=='static/img/user/default_avatar.jpg'?__HTTPLOCALIMG($recevice_user_info['avatar']) :__HTTPIMG($recevice_user_info['avatar'])), 'mobile'=>$mobile, 'nickname'=>$recevice_user_info['nickname']];
  885. }
  886. /**
  887. * @param $uid
  888. * @param $money
  889. * @param $mobile
  890. * @throws Exception
  891. * @throws \think\db\exception\DataNotFoundException
  892. * @throws \think\db\exception\DbException
  893. * @throws \think\db\exception\ModelNotFoundException
  894. */
  895. public function exchargeJHDone($uid, $money, $mobile)
  896. {
  897. [$user, $recevice_user_info, $need_jh] = $this->exchargeJhBefore($uid, $money, $mobile);
  898. edit_user_tz(5, $uid, $money, 0, $recevice_user_info['id']);
  899. edit_user_tz(6, $recevice_user_info['id'], $money, 0, $uid);
  900. }
  901. }