|
@@ -296,122 +296,6 @@ class UserCenter extends Common
|
|
|
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 主播申请
|
|
|
- */
|
|
|
- public function anchorApply() {
|
|
|
- $type_id = $this->request->request('type_id',0); // 技能分类ID
|
|
|
- $party_type_id = $this->request->request('party_type_id'); //分类ID
|
|
|
- $desc = $this->request->request('desc'); // 申请备注
|
|
|
- if (!$party_type_id && !$desc) {
|
|
|
- $this->error(__('Invalid parameters'));
|
|
|
- }
|
|
|
- $useranchorModel = new \app\common\model\UserAnchor();
|
|
|
- $data = [];
|
|
|
- $data["user_id"] = $this->auth->id;
|
|
|
- $data["type_id"] = $type_id;
|
|
|
- $data["party_type_id"] = $party_type_id;
|
|
|
- if($useranchorModel->where($data)->find()) $this->error(__('您已申请过该类型的主播,请勿重复申请!'));
|
|
|
- $data["desc"] = $desc;
|
|
|
- $data["createtime"] = time();
|
|
|
- $res = $useranchorModel->insertGetId($data);
|
|
|
- if($res) {
|
|
|
- \app\common\model\User::update(["is_anchor"=>1],["id"=>$this->auth->id]);
|
|
|
- $vbot = new \addons\vbot\Vbot();
|
|
|
- $vbot->vbotSendMsg('Anchor_Application_Notice', [], []);
|
|
|
- $this->success("申请发送成功!");
|
|
|
- } else {
|
|
|
- $this->error("网络错误,请稍后重试");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 实名认证
|
|
|
- */
|
|
|
- public function authApply() {
|
|
|
- $realname = $this->request->request('realname'); // 真实姓名
|
|
|
- $idcard = $this->request->request('idcard'); // 身份证号
|
|
|
- $zimage = $this->request->request('zimage'); // 身份证正面照
|
|
|
- $fimage = $this->request->request('fimage'); // 身份证反面照
|
|
|
- if (!$realname && !$idcard && !$zimage && !$fimage) {
|
|
|
- $this->error(__('Invalid parameters'));
|
|
|
- }
|
|
|
- $userauthModel = new \app\common\model\UserAuth();
|
|
|
- $data = [];
|
|
|
- $data["user_id"] = $this->auth->id;
|
|
|
- //$data["idcard"] = $idcard;
|
|
|
- $userAuth = $userauthModel->where($data)->find();
|
|
|
- if (!empty($userAuth)) {
|
|
|
- if(in_array($userAuth['status'],[0,1])) $this->error('您已经申请过了,请勿重复操作!');
|
|
|
- }
|
|
|
-
|
|
|
- // 测试需要 开始
|
|
|
- $data["realname"] = $realname;
|
|
|
- $zimage && $data["zimage"] = $zimage;
|
|
|
- $fimage && $data["fimage"] = $fimage;
|
|
|
- $data["status"] = 1;
|
|
|
- if (!empty($userAuth)) {
|
|
|
- $data["updatetime"] = time();
|
|
|
- $authWhere['user_id'] = $this->auth->id;
|
|
|
- $res = $userauthModel->where($authWhere)->update($data);
|
|
|
- } else {
|
|
|
- $data["createtime"] = time();
|
|
|
- $res = $userauthModel->insertGetId($data);
|
|
|
- }
|
|
|
- if($res) {
|
|
|
- \app\common\model\User::update(["is_auth"=>2],["id"=>$this->auth->id]);
|
|
|
- $this->success("恭喜,实名认证成功!");
|
|
|
- } else {
|
|
|
- $this->error("网络错误,请稍后重试");
|
|
|
- }
|
|
|
- // 测试需要 结束
|
|
|
-
|
|
|
- // 实名认证验证
|
|
|
- $configInfo = config("auth");
|
|
|
- $outh = new outh($configInfo["api_url"],$configInfo["customer_code"],$configInfo["private_key"],$configInfo["key"]);
|
|
|
-
|
|
|
- $out_trade_no = date("YmdHis").rand(1000,9999);
|
|
|
- $ret = $outh->toVerify($out_trade_no,$realname,$idcard);
|
|
|
-
|
|
|
- if(isset($ret["code"])) {
|
|
|
- if($ret["code"] == "1008") {
|
|
|
- $this->error(__('身份证格式错误'));
|
|
|
- }
|
|
|
- if($ret["code"] == "1009") {
|
|
|
- $this->error(__('身份证格式错误'));
|
|
|
- }
|
|
|
- if($ret["code"] == "0001") {
|
|
|
- $this->error(__('姓名和身份证号不匹配!'));
|
|
|
- }
|
|
|
- if($ret["code"] == "0000") {
|
|
|
- $data["realname"] = $realname;
|
|
|
- $zimage && $data["zimage"] = $zimage;
|
|
|
- $fimage && $data["fimage"] = $fimage;
|
|
|
- $data["status"] = 1;
|
|
|
- $data["createtime"] = time();
|
|
|
- $res = $userauthModel->insertGetId($data);
|
|
|
- if($res) {
|
|
|
- \app\common\model\User::update(["is_auth"=>2],["id"=>$this->auth->id]);
|
|
|
- $this->success("恭喜,实名认证成功!");
|
|
|
- } else {
|
|
|
- $this->error("网络错误,请稍后重试");
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- $this->error("网络错误,请稍后重试");
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取主播分类
|
|
|
- */
|
|
|
- public function getAnchorType() {
|
|
|
- $this->success("获取成功!",\app\common\model\UserAnchorType::select());
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
|
|
|
/**
|