checkToken(); if ($token['code'] < 0) return $this->response($token); $resModel = new WeappletReg(); $where = [ 'agent_site_id' => $this->site_id, 'member_id' => $this->member_id, ]; $list = $resModel->where($where)->paginate()->each(function ($data) use ($resModel){ if($data->pay_status==0){ $data->status_text='待支付'; }else{ $data->status_text=$resModel->StatusText[$data->status]; } return $data; }); return $this->response($this->success($list)); } /**** * 注册小程序 * @return false|string */ public function reg() { $token = $this->checkToken(); if ($token['code'] < 0) return $this->response($token); $data = request()->post(); $validate = new Reg(); $website_model = new WebsiteModel(); $agnetInfo=$website_model->getWebSite(['member_id'=>$this->member_id])['data']; if($agnetInfo['is_apply']!=1) return $this->response($this->error('您还不是代理商')); if ($validate->scene()->check($data)) { $data['site_id'] = 0; $data['member_id'] = $this->member_id; $data['agent_site_id'] = $this->site_id; $data['pay_money'] = $agnetInfo['wxreg_rate']; $data['app_type'] = 'weapp'; $resModel = new WeappletReg(); $where = [ ['member_id', '=', $this->member_id], ['name', '=', $data['name']], ['status', '>', 0] ]; $resInfo = $resModel->where($where)->find(); if ($resInfo) { $save = $resInfo->save($data); } else { $order_no = $resModel->createOrderNo($data['site_id'], $data['member_id']); $data['order_no'] =$order_no; $save = $resModel->save($data); } if ($save) { $res = $this->success('录入完成'); } else { $res = $this->error(); } } else { $res = $this->error($validate->getError()); } return $this->response($res); } /*** * 编辑注册信息 * @return false|string * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function editinfo() { $token = $this->checkToken(); if ($token['code'] < 0) return $this->response($token); $data = request()->post(); $validate = new Reg(); if ($validate->check($data)) { $resModel = new WeappletReg(); $where = [ ['id', '=', $data['id']], ['status', '>', 0] ]; $resInfo = $resModel->where($where)->find(); if ($resInfo && $resInfo['status']!=0) { if ($resInfo->save($data)) { if($resInfo['pay_status']==1){ $cron_model = new Cron(); $execute_time=time(); $cron_model->addCron(1, 0, "提交小程序申请", "ApplyAutoSubmit", $execute_time, $resInfo['id']); } $res = $this->success('编辑成功'); } else { $res = $this->error('资料相同未更新'); } } else { $res = $this->error('信息不存在或已审核'); } } else { $res = $this->error($validate->getError()); } return $this->response($res); } /*** * 获取注册信息 * @return false|string * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function info() { $token = $this->checkToken(); if ($token['code'] < 0) return $this->response($token); $id=input('id',0); $resModel = new WeappletReg(); $resInfo = $resModel->where('id',$id)->find(); return $this->response($this->success($resInfo)); } }