diff --git a/application/admin/controller/cardocr/Card.php b/application/admin/controller/cardocr/Card.php new file mode 100644 index 0000000..37a7637 --- /dev/null +++ b/application/admin/controller/cardocr/Card.php @@ -0,0 +1,232 @@ +model = new \app\admin\model\cardocr\Card; + $this->view->assign("sexList", $this->model->getSexList()); + $this->view->assign("statusList", $this->model->getStatusList()); + } + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + + + /** + * 查看 + */ + public function index() + { + //当前是否为关联查询 + $this->relationSearch = true; + //设置过滤方法 + $this->request->filter(['strip_tags']); + if ($this->request->isAjax()) { + //如果发送的来源是Selectpage,则转发到Selectpage + if ($this->request->request('keyField')) { + return $this->selectpage(); + } + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); + $total = $this->model + ->with(['user']) + ->where($where) + ->order($sort, $order) + ->count(); + + $list = $this->model + ->with(['user']) + ->where($where) + ->order($sort, $order) + ->limit($offset, $limit) + ->select(); + + foreach ($list as $row) { + } + $list = collection($list)->toArray(); + $result = array("total" => $total, "rows" => $list); + + return json($result); + } + return $this->view->fetch(); + } + + /** + * 编辑 + */ + public function edit($ids = null) + { + $row = $this->model->get($ids); + if (!$row) { + $this->error(__('No Results were found')); + } + + if ($this->request->isPost()) { + $params = $this->request->post("row/a"); + + if ($params) { + // $params = $this->preExcludeFields($params); + $result = false; + + //开启api验证 + if ($params['isthroughapi'] == 1) { + $url = Config::get('upload.cdnurl'); + $ImageUrl = cdnurl($params['positive_img'],true); + $ImagebackUrl = cdnurl($params['back_img'],true); + + //orc获取正面信息 + $front_data = $this->checkfront($ImageUrl); + $front_data = array_change_key_case($front_data, CASE_LOWER); + $params = $front_data + $params; + + //orc获取反面信息 + $back_data = $this->checkback($ImagebackUrl); + $back_data = array_change_key_case($back_data['backdata'], CASE_LOWER); + + $params = array_filter($back_data) + $params; + + $params_data = \addons\cardocr\library\Card::checkidcard($params['idnum'], $params['name']); + + + if ($params_data['Result'] != 0) { + $this->error(__('姓名与身份号码不一致', '')); + } + + //修改审核通过 + $params['status'] = 1; + } + + Db::startTrans(); + try { + //是否采用模型验证 + if ($this->modelValidate) { + $name = str_replace("\\model\\", "\\validate\\", get_class($this->model)); + $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate; + $row->validateFailException(true)->validate($validate); + } + $result = $row->allowField(true)->save($params); + Db::commit(); + } catch (ValidateException $e) { + Db::rollback(); + $this->error($e->getMessage()); + } catch (PDOException $e) { + Db::rollback(); + $this->error($e->getMessage()); + } catch (Exception $e) { + Db::rollback(); + $this->error($e->getMessage()); + } + if ($result !== false) { + $this->success(); + } else { + $this->error(__('No rows were updated')); + } + } + $this->error(__('Parameter %s can not be empty', '')); + } + $this->view->assign("row", $row); + return $this->view->fetch(); + } + + /** + * 添加 + */ + public function add() + { + if ($this->request->isPost()) { + $params = $this->request->post("row/a"); + if ($params) { + // $params = $this->preExcludeFields($params); + + if ($this->dataLimit && $this->dataLimitFieldAutoFill) { + $params[$this->dataLimitField] = $this->auth->id; + } + + //开启api验证 + if ($params['isthroughapi'] == 1) { + $url = Config::get('upload.cdnurl'); + $ImageUrl = cdnurl($params['positive_img'],true); + $ImagebackUrl = cdnurl($params['back_img'],true); + + //orc获取正面信息 + $front_data = $this->checkfront($ImageUrl); + $front_data = array_change_key_case($front_data, CASE_LOWER); + $params = $front_data + $params; + + //orc获取反面信息 + $back_data = $this->checkback($ImagebackUrl); + $back_data = array_change_key_case($back_data['backdata'], CASE_LOWER); + + //修改审核通过 + $params['status'] = 1; + $params = array_filter($back_data) + $params; + + //调用api身份证实名验证 + $params_data = \addons\cardocr\library\Card::checkidcard($params['idnum'], $params['name']); + + + if ($params_data['Result'] != 0) { + $this->error(__('姓名与身份号码不一致', '')); + } + } + + $result = false; + Db::startTrans(); + try { + //是否采用模型验证 + if ($this->modelValidate) { + $name = str_replace("\\model\\", "\\validate\\", get_class($this->model)); + $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate; + $this->model->validateFailException(true)->validate($validate); + } + $result = $this->model->allowField(true)->save($params); + Db::commit(); + } catch (ValidateException $e) { + Db::rollback(); + $this->error($e->getMessage()); + } catch (PDOException $e) { + Db::rollback(); + $this->error($e->getMessage()); + } catch (Exception $e) { + Db::rollback(); + $this->error($e->getMessage()); + } + if ($result !== false) { + $this->success(); + } else { + $this->error(__('No rows were inserted')); + } + } + $this->error(__('Parameter %s can not be empty', '')); + } + return $this->view->fetch(); + } +} diff --git a/application/admin/controller/school/activity/Join.php b/application/admin/controller/school/activity/Join.php new file mode 100644 index 0000000..9ce658d --- /dev/null +++ b/application/admin/controller/school/activity/Join.php @@ -0,0 +1,71 @@ +model = new \app\admin\model\school\activity\Join; + + } + + + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + + + /** + * 查看 + */ + public function index() + { + //当前是否为关联查询 + $this->relationSearch = true; + //设置过滤方法 + $this->request->filter(['strip_tags', 'trim']); + if ($this->request->isAjax()) { + //如果发送的来源是Selectpage,则转发到Selectpage + if ($this->request->request('keyField')) { + return $this->selectpage(); + } + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); + + $list = $this->model + ->with(['user']) + ->where($where) + ->order($sort, $order) + ->paginate($limit); + + foreach ($list as $row) { + + $row->getRelation('user')->visible(['nickname','mobile','avatar']); + } + + $result = array("total" => $list->total(), "rows" => $list->items()); + + return json($result); + } + return $this->view->fetch(); + } + +} diff --git a/application/admin/lang/zh-cn/cardocr/card.php b/application/admin/lang/zh-cn/cardocr/card.php new file mode 100644 index 0000000..eea84dd --- /dev/null +++ b/application/admin/lang/zh-cn/cardocr/card.php @@ -0,0 +1,54 @@ + '会员ID', + 'Name' => '姓名', + 'Sex' => '性别', + 'Nation' => '民族', + 'Birth' => '生日', + 'Address' => '身份证地址', + 'Idnum' => '身份证id', + 'Authority' => '发证机关', + 'Validdatestart' => '有效期开始', + 'Validdateend' => '有效期结束', + 'Status' => '身份审核状态', + 'Pass' => '通过', + 'Down' => '拒绝', + 'Unaudited' => '待审核', + 'Positive_img' => '身份证正面', + 'Back_img' => '身份证反面', + 'IsthroughAPI' => '是否通过api审核', + 'Memo' => '备注', + 'Createtime' => '创建时间', + 'Updatetime' => '更新时间', + 'Publishtime' => '审核时间', + 'User.id' => 'ID', + 'User.group_id' => '组别ID', + 'User.username' => '用户名', + 'User.nickname' => '昵称', + 'User.password' => '密码', + 'User.salt' => '密码盐', + 'User.email' => '电子邮箱', + 'User.mobile' => '手机号', + 'User.avatar' => '头像', + 'User.level' => '等级', + 'User.gender' => '性别', + 'User.birthday' => '生日', + 'User.bio' => '格言', + 'User.money' => '余额', + 'User.score' => '积分', + 'User.ccoin' => 'C币', + 'User.successions' => '连续登录天数', + 'User.maxsuccessions' => '最大连续登录天数', + 'User.prevtime' => '上次登录时间', + 'User.logintime' => '登录时间', + 'User.loginip' => '登录IP', + 'User.loginfailure' => '失败次数', + 'User.joinip' => '加入IP', + 'User.jointime' => '加入时间', + 'User.createtime' => '创建时间', + 'User.updatetime' => '更新时间', + 'User.token' => 'Token', + 'User.status' => '状态', + 'User.verification' => '验证' +]; diff --git a/application/admin/lang/zh-cn/school/activity/join.php b/application/admin/lang/zh-cn/school/activity/join.php new file mode 100644 index 0000000..71b1209 --- /dev/null +++ b/application/admin/lang/zh-cn/school/activity/join.php @@ -0,0 +1,12 @@ + '会员ID', + 'Name' => '姓名', + 'Idnum' => '身份证号', + 'Createtime' => '创建时间', + 'Updatetime' => '更新时间', + 'User.nickname' => '昵称', + 'User.mobile' => '手机号', + 'User.avatar' => '头像' +]; diff --git a/application/admin/model/cardocr/Card.php b/application/admin/model/cardocr/Card.php new file mode 100644 index 0000000..87b8ed8 --- /dev/null +++ b/application/admin/model/cardocr/Card.php @@ -0,0 +1,64 @@ + __('男'), '女' => __('女'), '未知' => __('未知')]; + } + + public function getStatusList() + { + return ['0' => __('Down'), '1' => __('Pass'), '2' => __('Unaudited')]; + } + + + public function getSexTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['sex']) ? $data['sex'] : ''); + $list = $this->getSexList(); + return isset($list[$value]) ? $list[$value] : ''; + } + + + public function getPublishtimeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['publishtime']) ? $data['publishtime'] : ''); + return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; + } + + protected function setPublishtimeAttr($value) + { + return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); + } + + + public function user() + { + return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); + } +} diff --git a/application/admin/model/school/activity/Join.php b/application/admin/model/school/activity/Join.php new file mode 100644 index 0000000..20299ca --- /dev/null +++ b/application/admin/model/school/activity/Join.php @@ -0,0 +1,44 @@ +belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); + } +} diff --git a/application/admin/validate/cardocr/Card.php b/application/admin/validate/cardocr/Card.php new file mode 100644 index 0000000..db67b7d --- /dev/null +++ b/application/admin/validate/cardocr/Card.php @@ -0,0 +1,26 @@ + [], + 'edit' => [], + ]; +} diff --git a/application/admin/validate/school/activity/Join.php b/application/admin/validate/school/activity/Join.php new file mode 100644 index 0000000..83a9b65 --- /dev/null +++ b/application/admin/validate/school/activity/Join.php @@ -0,0 +1,27 @@ + [], + 'edit' => [], + ]; + +} diff --git a/application/admin/view/cardocr/card/add.html b/application/admin/view/cardocr/card/add.html new file mode 100644 index 0000000..c05ff09 --- /dev/null +++ b/application/admin/view/cardocr/card/add.html @@ -0,0 +1,159 @@ +
+
+ 提示! 打开最下面的"通过api审核"按钮,只需选择"会员id",填写"姓名","身份证号码",上传身份正反面,提交后便可自动填写数据。 +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ + +
+
+
+ +
+
+ +
+ + +
+ +
+
    +
    +
    +
    + +
    +
    + +
    + + +
    + +
    +
      +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + + + + +
      +
      + +
      diff --git a/application/admin/view/cardocr/card/edit.html b/application/admin/view/cardocr/card/edit.html new file mode 100644 index 0000000..8b370bc --- /dev/null +++ b/application/admin/view/cardocr/card/edit.html @@ -0,0 +1,161 @@ +
      +
      + 提示! 打开最下面的"通过api审核"按钮,可以获取身份证与图片是否一致。 +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + + + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + + +
      +
      +
      + +
      +
      + +
      + + +
      + +
      +
        +
        +
        +
        + +
        +
        + +
        + + +
        + +
        +
          +
          +
          +
          + +
          + +
          +
          +
          + +
          + +
          +
          +
          + +
          + + + + +
          +
          + +
          diff --git a/application/admin/view/cardocr/card/index.html b/application/admin/view/cardocr/card/index.html new file mode 100644 index 0000000..9e78db8 --- /dev/null +++ b/application/admin/view/cardocr/card/index.html @@ -0,0 +1,47 @@ +
          + {:build_heading()} + +
          + +
          +
          diff --git a/application/admin/view/school/activity/join/add.html b/application/admin/view/school/activity/join/add.html new file mode 100644 index 0000000..777a668 --- /dev/null +++ b/application/admin/view/school/activity/join/add.html @@ -0,0 +1,33 @@ +
          + +
          + +
          + + + + + + + +
          +
          +
          + +
          + +
          +
          +
          + +
          + +
          +
          + +
          diff --git a/application/admin/view/school/activity/join/edit.html b/application/admin/view/school/activity/join/edit.html new file mode 100644 index 0000000..4debcd9 --- /dev/null +++ b/application/admin/view/school/activity/join/edit.html @@ -0,0 +1,36 @@ +
          + +
          + +
          + + + + + + + + + +
          + +
          +
          + +
          + +
          +
          +
          + +
          + +
          +
          + +
          diff --git a/application/admin/view/school/activity/join/index.html b/application/admin/view/school/activity/join/index.html new file mode 100644 index 0000000..526db64 --- /dev/null +++ b/application/admin/view/school/activity/join/index.html @@ -0,0 +1,29 @@ +
          + {:build_heading()} + +
          +
          +
          + +
          + +
          +
          +
          diff --git a/application/api/controller/User.php b/application/api/controller/User.php index 737d13e..5d1d86a 100644 --- a/application/api/controller/User.php +++ b/application/api/controller/User.php @@ -339,6 +339,7 @@ class User extends Api $data["settle_info"] = SettleLog::getUserSettleInfo($this->auth->id); //活动信息 $data["activity_info"] = Activity::getActivityInfo($this->auth->id); + $data["realname_info"] = (new \app\common\model\cardocr\Card)->checkRealname($this->auth->id); $this->success('调用成功',$data); } diff --git a/application/api/controller/school/RealName.php b/application/api/controller/school/RealName.php new file mode 100644 index 0000000..7923383 --- /dev/null +++ b/application/api/controller/school/RealName.php @@ -0,0 +1,106 @@ +model = new \app\common\model\cardocr\Card(); + parent::_initialize(); + + //判断登录用户是否是员工 + } + + + + + /** + * @ApiTitle( 更新或保存实名认证信息) + * @ApiSummary(更新或保存实名认证信息) + * @ApiMethod(POST) + * @ApiParams(name = "name", type = "string",required=true,description = "姓名") + * @ApiParams(name = "idnum", type = "string",required=true,description = "身份证号") + * @ApiParams(name = "positive_img", type = "string",required=true,description = "身份证正面") + * @ApiParams(name = "back_img", type = "string",required=true,description = "身份证反面") + * @ApiReturn({ + * + *}) + */ + public function save() + { + $user_id = 0; + $user = $this->auth->getUser();//登录用户 + if($user)$user_id = $user['id']; + $params =[]; + $params["name"] = $this->request->param('name/s', ''); //页数 + $params["idnum"] = $this->request->param('idnum/s', ''); //条数 + $params["positive_img"] = $this->request->param('positive_img/s', ''); //搜索关键字 + $params["back_img"] = $this->request->param('back_img/s', ''); //搜索关键字 + $params["user_id"] = $user_id; +// $params = []; +// +// $params["auth_status"] = $this->request->get('auth_status/s', ''); //搜索关键字 + +// $activity_id = $this->request->get('activity_id/s', ''); //搜索关键字 +// +// $has_evaluate = $this->request->get('has_evaluate/d', 0); //搜索关键字 +// $type = $this->request->get('type/s', ''); //筛选学员和教练单 + + try{ + //当前申请状态 + $res = $this->model->add($params,true); +// if($user_id =='670153'){ +// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql()); +// } + }catch (\Exception $e){ + + $this->error($e->getMessage()); + } + $this->success('认证成功', $res); + } + + + + /** + * @ApiTitle(实名认证信息查询) + * @ApiSummary(实名认证信息查询) + * @ApiMethod(GET) + * @ApiReturn({ + * + *}) + */ + public function info() + { + $user_id = 0; + $user = $this->auth->getUser();//登录用户 + if($user)$user_id = $user['id']; + + try{ + //当前申请状态 + $res = $this->model->checkRealname($user_id); + + }catch (\Exception $e){ + + $this->error($e->getMessage()); + } + $this->success('查询成功', $res); + } + +} \ No newline at end of file diff --git a/application/api/controller/school/newactivity/ActivityJoin.php b/application/api/controller/school/newactivity/ActivityJoin.php new file mode 100644 index 0000000..af35e78 --- /dev/null +++ b/application/api/controller/school/newactivity/ActivityJoin.php @@ -0,0 +1,192 @@ +transactionCheck(); + + $this->model = new Join; + parent::_initialize(); + + +// $this->setUrlLock(); + } + + + + + + /** + * @ApiTitle( 成员列表接口) + * @ApiSummary(成员列表接口) + * @ApiMethod(GET) + * @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字") + * @ApiParams(name = "page", type = "string",required=true,description = "页数") + * @ApiParams(name = "limit", type = "string",required=true,description = "条数") + * + * @ApiReturn({ + * + *}) + */ + public function people_list() + { + $user_id = 0; + $user = $this->auth->getUser();//登录用户 + if($user)$user_id = $user['id']; + + $params = []; + $params['user_id'] = $user_id; + $page = $this->request->get('page/d', 0); //页数 + $limit = $this->request->get('limit/d', 0); //条数 + $params["keywords"] = $this->request->get('keywords/s', ''); //搜索关键字 + + +// $params["time"] = $this->request->get('time/s', ''); //时间 + + try{ + //当前申请状态 + $res = $this->model::joinList($page, $limit,$params); +// if($user_id =='670153'){ +// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql()); +// } + }catch (\Exception $e){ + + $this->error($e->getMessage()); + } + $this->success('查询成功', $res); + } + + + /** + * @ApiTitle( 成员详情) + * @ApiSummary(成员详情) + * @ApiMethod(GET) + * @ApiParams(name = "id", type = "int",required=true,description = "成员id") + * @ApiReturn({ + * + *}) + */ + public function detail(){ + $id = $this->request->get('id/d',''); + + if(empty($id)){ + $this->error(__('缺少必要参数')); + } + + try { + $res = $this->model->detail($id); + } catch (\Exception $e){ +// Log::log($e->getMessage()); + $this->error($e->getMessage(),['errcode'=>$e->getCode()]); + } + $this->success('获取成功', ['detail' => $res]); + } + + + + /** + * 删除成员 + * + * @ApiMethod (POST) + * @ApiParams (name="ids", type="string", required=true, description="要删除的ids") + */ + public function del() + { +// $admin_id = $this->auth->id; + $ids = $this->request->post('ids/s'); + + try{ + $menulist = $this->model->del($ids,true); + } catch (\Exception $e) { + $this->error($e->getMessage()); + } + + $this->success('删除成功', $menulist); + } + + + + + + + /** + * @ApiTitle(添加成员) + * @ApiSummary(添加成员) + * @ApiMethod(POST) + * @ApiParams(name = "name", type = "int",required=true,description = "姓名") + * @ApiParams(name = "idnum", type = "string",required=true,description = "身份证号") + * @ApiReturn({ + * + *}) + */ + public function add(){ + + $user_id = 0; + $user = $this->auth->getUser();//登录用户 + if($user)$user_id = $user['id']; + $params = []; + $params["user_id"] = $user_id; //老师id + $params["name"] = $this->request->post('name/s', ''); //课程标签 + $params["idnum"] = $this->request->post('idnum/s', ''); //课程标签 + + try{ + $res = $this->model->add($params,true); + }catch (\Throwable $e){ + $this->error($e->getMessage()); + } + $this->success('添加成功', $res); + } + + + + /** + * @ApiTitle(编辑成员) + * @ApiSummary(编辑成员) + * @ApiMethod(POST) + * @ApiRoute (/api/school.newactivity.activity_join/edit/ids/{ids}) + * @ApiParams (name="ids", type="string", required=true, description="需要编辑的id") + * @ApiParams(name = "name", type = "int",required=true,description = "姓名") + * @ApiParams(name = "idnum", type = "string",required=true,description = "身份证号") + * @ApiReturn({ + * + *}) + */ + public function edit($ids = null){ + + $user_id = 0; + $user = $this->auth->getUser();//登录用户 + if($user)$user_id = $user['id']; + $params = []; + $params["user_id"] = $user_id; //老师id + $params["name"] = $this->request->post('name/s', ''); //课程标签 + $params["idnum"] = $this->request->post('idnum/s', ''); //课程标签 + + try{ + $res = $this->model->edit($ids,$params,true); + }catch (\Throwable $e){ + $this->error($e->getMessage()); + } + $this->success('编辑成功', $res); + } + + +} \ No newline at end of file diff --git a/application/api/controller/school/newactivity/Order.php b/application/api/controller/school/newactivity/Order.php index ff199b7..628c7a4 100644 --- a/application/api/controller/school/newactivity/Order.php +++ b/application/api/controller/school/newactivity/Order.php @@ -147,8 +147,9 @@ class Order extends Base * @ApiMethod(POST) * @ApiParams(name = "activity_id", type = "int",required=true,description = "活动id") * @ApiParams(name = "order_no", type = "string",required=false,description = "缓存key") - * @ApiParams(name = "num", type = "int",required=true,description = "购买人数") + * @ApiParams(name = "people", type = "string",required=true,description = "(需url编码)参与人员信息json [{name:"小明",idnum:"410303199501220515"}]") * @ApiParams(name = "is_compute", type = "int",required=false,description = "是否重新计算并更新缓存 默认传1") + * @ApiParams(name = "desc", type = "string",required=false,description = "下单备注") * @ApiReturn({ * *}) @@ -158,13 +159,25 @@ class Order extends Base $user = $this->auth->getUser();//登录用户 if($user)$user_id = $user['id']; $activity_id = $this->request->post('activity_id/d', 0); //课程id - $num = $this->request->post('num/d', 0); //想同时约的课时id -// $param = urldecode($this->request->post('param/s', "{}")); //参数 +// $num = $this->request->post('num/d', 0); //想同时约的课时id + $num = 0; //想同时约的课时id + $param = []; + $people = urldecode($this->request->post('people/s', "{}") ?: "{}"); //参数 +// if($people){ + $param["people"] = json_decode($people,true); + $num = count($param["people"]); + +// } + //参数 $order_no = $this->request->post('order_no/s', ''); //订单号 $is_compute = $this->request->post('is_compute/d', 1); //是否重新计算并更新缓存 + + + $param["desc"] = $this->request->post('desc/s', ''); //订单号 + try{ //当前申请状态 $res = $this->model->confirm($user_id, $activity_id,$num,$order_no,$param, $is_compute); diff --git a/application/api/controller/school/newactivity/SettleLog.php b/application/api/controller/school/newactivity/SettleLog.php index 9293ca5..dda9358 100644 --- a/application/api/controller/school/newactivity/SettleLog.php +++ b/application/api/controller/school/newactivity/SettleLog.php @@ -180,12 +180,13 @@ class SettleLog extends Base $user = $this->auth->getUser();//登录用户 if($user)$user_id = $user['id']; $params =[]; - $params["name"] = $this->request->post('name/s', ''); //页数 - $params["bank_name"] = $this->request->post('bank_name/s', ''); //条数 - $params["bank_user_name"] = $this->request->post('bank_user_name/s', ''); //搜索关键字 - $params["id_number"] = $this->request->post('id_number/s', ''); //搜索关键字 + $params["name"] = $this->request->param('name/s', ''); //页数 + $params["bank_name"] = $this->request->param('bank_name/s', ''); //条数 + $params["bank_user_name"] = $this->request->param('bank_user_name/s', ''); //搜索关键字 + $params["id_number"] = $this->request->param('id_number/s', ''); //搜索关键字 - $params = []; +// $params = []; +// // $params["auth_status"] = $this->request->get('auth_status/s', ''); //搜索关键字 // $activity_id = $this->request->get('activity_id/s', ''); //搜索关键字 diff --git a/application/common/model/cardocr/Card.php b/application/common/model/cardocr/Card.php new file mode 100644 index 0000000..b608429 --- /dev/null +++ b/application/common/model/cardocr/Card.php @@ -0,0 +1,186 @@ + __('男'), '女' => __('女'), '未知' => __('未知')]; + } + + public function getStatusList() + { + return ['0' => __('Down'), '1' => __('Pass'), '2' => __('Unaudited')]; + } + + + public function getSexTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['sex']) ? $data['sex'] : ''); + $list = $this->getSexList(); + return isset($list[$value]) ? $list[$value] : ''; + } + + + public function getPublishtimeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['publishtime']) ? $data['publishtime'] : ''); + return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; + } + + protected function setPublishtimeAttr($value) + { + return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); + } + + + public function user() + { + return $this->belongsTo('app\common\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + + + + /** 新增实名认证 + * @param $params + * @param $trans + * @return $this + * @throws \Exception + */ + public function add($params,$trans=false){ + + if (empty($params)) { + throw new \Exception(__('Parameter %s can not be empty', '')); + } + + $rule = [ + 'user_id'=>'require', + 'name'=>'require', + 'idnum'=>'require', + 'positive_img' => 'require', + 'back_img'=>'require', + ]; + + $rule_msg = [ + "user_id.require"=>'认证用户必填', + "name.require"=>'姓名必填', + "idnum.require"=>'身份证号必填', + 'positive_img.require' => '身份证正面必填', + 'back_img.require' => '身份证反面必填', + ]; + + self::check($params,$rule,$rule_msg); + + + $user_id = $params["user_id"]; + + + + //开启api验证 + if (config("site.realname_isthroughapi")) { + $url = Config::get('upload.cdnurl'); + $ImageUrl = cdnurl($params['positive_img'],true); + $ImagebackUrl = cdnurl($params['back_img'],true); + + //orc获取正面信息 + $front_data = $this->checkfront($ImageUrl); + $front_data = array_change_key_case($front_data, CASE_LOWER); + $params = $front_data + $params; + + //orc获取反面信息 + $back_data = $this->checkback($ImagebackUrl); + $back_data = array_change_key_case($back_data['backdata'], CASE_LOWER); + + //修改审核通过 + $params['status'] = 1; + $params["publishtime"] = time(); + $params = array_filter($back_data) + $params; + + //调用api身份证实名验证 + $params_data = \addons\cardocr\library\Card::checkidcard($params['idnum'], $params['name']); + + + if ($params_data['Result'] != 0) { + throw new \Exception(__('姓名与身份号码不一致', '')); + } + } + if(config("site.real_name_automatic_approval")){ + $params['status'] = 1; + $params["publishtime"] = time(); + } + + + +//判断逻辑 + if($trans){ + self::beginTrans(); + } + $res = true; + try{ + //查询是否有认证信息,如果有则修改,如果没有则添加 + $card = self::where('user_id',$user_id)->find(); + if($card){ + $result = $card->allowField(true)->save($params); + $self = $card; + }else{ + $result = $this->allowField(true)->save($params); + $self = $this; + } + + + if($trans){ + self::commitTrans(); + } + }catch (\Exception $e){ + if($trans){ + self::rollbackTrans(); + } + throw new \Exception($e->getMessage().$e->getFile().$e->getLine()); + } + return $self; + } + + + /** 检测实名认证状态 + * @param $user_id + */ + public function checkRealname($user_id=0){ + //默认状态为-1未认证,0认证被拒绝,1认证通过,2=等待审核 + $status = -1; + $card_info = self::where('user_id',$user_id)->find(); //认证信息 + if($card_info){ + $status = $card_info['status']; + } + return compact('status' , 'card_info'); + } + + + + + +} diff --git a/application/common/model/school/activity/Activity.php b/application/common/model/school/activity/Activity.php index bec89d0..6516475 100644 --- a/application/common/model/school/activity/Activity.php +++ b/application/common/model/school/activity/Activity.php @@ -1032,6 +1032,8 @@ class Activity extends BaseModel $self['join_info'] = self::getJoininfo($id,$self["stock"],10); + $self['some_people'] = self::getSomePeople($id); + //退款政策 $self['refund_info'] = Refund::where("id",$self["refund_id"])->find(); @@ -1386,6 +1388,28 @@ class Activity extends BaseModel return compact("users","people_number","percent","stock"); } + + + + + /*** 下单片段 + * @param $id + * @param $limit + * @return void + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\ModelNotFoundException + * @throws \think\exception\DbException + */ + public static function getSomePeople($id,$limit=3) + { + + $users = []; + + return compact("users"); + } + + + /** 取消活动 * @param $id * @param $check diff --git a/application/common/model/school/activity/Join.php b/application/common/model/school/activity/Join.php new file mode 100644 index 0000000..dad9a67 --- /dev/null +++ b/application/common/model/school/activity/Join.php @@ -0,0 +1,309 @@ +belongsTo('app\common\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + + + + + + + + + + + + /** 通用新增(后台api版本) + * @param $params + * @param $trans + * @return $this + * @throws \Exception + */ + public function add($params,$trans=false){ + + if (empty($params)) { + throw new \Exception(__('Parameter %s can not be empty', '')); + } + + + + $rule = [ + 'user_id'=>'require', + 'name'=>'require', + 'idnum'=>'require', + ]; + + $rule_msg = [ + "user_id.require"=>'用户必填', + "name.require"=>'姓名必填', + "idnum.require"=>'身份证号必填', + ]; + + self::check($params,$rule,$rule_msg); + + + +//判断逻辑 + if($trans){ + self::beginTrans(); + } + $res = true; + try{ + + //是否采用模型验证 + + + $result = $this->allowField(true)->save($params); + + if($trans){ + self::commitTrans(); + } + }catch (\Exception $e){ + if($trans){ + self::rollbackTrans(); + } + throw new \Exception($e->getMessage().$e->getFile().$e->getLine()); + } + return $this; + } + + + /** 通用编辑(后台api版本) + * @param $params + * @param $trans + * @return $this + * @throws \Exception + */ + public function edit($id,$params,$trans=false){ + + $row = $this->get($id); + if (!$row) { + throw new \Exception(__('No Results were found')); + } + + + + if (empty($params)) { + throw new \Exception(__('Parameter %s can not be empty', '')); + } + + + + + $rule = [ + 'user_id'=>'require', + 'name'=>'require', + 'idnum'=>'require', + ]; + + $rule_msg = [ + "user_id.require"=>'用户必填', + "name.require"=>'姓名必填', + "idnum.require"=>'身份证号必填', + ]; + + self::check($params,$rule,$rule_msg); + + + +//判断逻辑 + if($trans){ + self::beginTrans(); + } + $res = true; + try{ + + + $result = $row->allowField(true)->save($params); + + if($trans){ + self::commitTrans(); + } + }catch (\Exception $e){ + if($trans){ + self::rollbackTrans(); + } + throw new \Exception($e->getMessage().$e->getFile().$e->getLine()); + } + return $row; + } + + + /** 通用详情(后台api版本) + * @param $params + * @param $trans + * @return $this + * @throws \Exception + */ + public function detail($id,$show_field=[],$except_field=[]){ + $row = $this->get($id); + if (!$row) { + throw new \Exception(__('No Results were found')); + } + if($show_field){ + $row->visible($show_field); + } + if($except_field){ + $row->hidden($except_field); + } + return $row; + } + +// public function index($page,$limit,$where=[]) +// { +// $adminIds = $this->getDataLimitAdminIds(); +// $aliasName = "" ; +// if (is_array($adminIds)) { +// $where[] = [$aliasName . $this->dataLimitField, 'in', $adminIds]; +// } +// +// } + + + /** 通用删除(后台api版本) + * @param $params + * @param $trans + * @return $this + * @throws \Exception + */ + public function del($ids = null,$trans=false){ + if (empty($ids)) { + throw new \Exception(__('Parameter %s can not be empty', 'ids')); + } +//判断逻辑 + + $pk = $this->getPk(); + + $list = $this->where($pk, 'in', $ids)->select(); + $count = 0; + if($trans){ + self::beginTrans(); + } + $res = true; + try{ + + foreach ($list as $item) { + $count += $item->delete(); + } + + if($trans){ + self::commitTrans(); + } + }catch (\Exception $e){ + if($trans){ + self::rollbackTrans(); + } + throw new \Exception($e->getMessage().$e->getFile().$e->getLine()); + } + return $count; + } + + + + + + /**得到基础条件 + * @param $status + * @param null $model + * @param string $alisa + */ + public static function getBaseWhere($whereData = [], $model = null, $alisa = '',$with = false) + { + + if (!$model) { + $model = new static; + if ($alisa&&!$with) $model = $model->alias($alisa); + } + if ($alisa) $alisa = $alisa . '.'; + $tableFields = (new static)->getTableFields(); + foreach ($tableFields as $fields) + { + if(in_array($fields, ["user_id"]))continue; +// if (isset($whereData[$fields]) && $whereData[$fields]) $model = $model->where("{$alisa}{$fields}", '=', $whereData[$fields]); + + if (isset($whereData[$fields]) && $whereData[$fields]){ + if(is_array($whereData[$fields])){ + $model = $model->where("{$alisa}{$fields}", $whereData[$fields][0], $whereData[$fields][1]); + }else{ + $model = $model->where("{$alisa}{$fields}", '=', $whereData[$fields]); + } + + } + + + } + if (isset($whereData['user_id']) && $whereData['user_id']) $model = $model->where("{$alisa}user_id", 'in', $whereData['user_id']); + + if (isset($whereData['keywords'])&&$whereData['keywords']) $model = $model->where("{$alisa}name|{$alisa}idnum", 'like', "%". $whereData['keywords']."%"); + + if (isset($whereData['time'])&&$whereData['time']){ + $model = $model->time(["{$alisa}createtime",$whereData['time']]); + } + + + + + + return $model; + } + + + + + public static function joinList($page, $limit,$params=[]){ + $with_field = [ + 'base'=>['*'], + ]; + $alisa = (new self)->getWithAlisaName(); + $sort = "{$alisa}.id desc"; + $serch_where = []; + $serch_where = array_merge($serch_where,$params); + return (new self)->getBaseList($serch_where, $page, $limit,$sort,$with_field); + } + + + + + + +} diff --git a/application/common/model/school/activity/order/Order.php b/application/common/model/school/activity/order/Order.php index f2f9a18..b961093 100644 --- a/application/common/model/school/activity/order/Order.php +++ b/application/common/model/school/activity/order/Order.php @@ -849,7 +849,7 @@ class Order extends BaseModel //订单支付更新 $order = self::updatePay($order,$notify); //生成订单一维码和二维码 - $order = self::buildCode($order); +// $order = self::buildCode($order); //记录订单日志 OrderLog::log($order['id'],"活动订单支付成功,核销码生成,等待核销",'user',$order['user_id']); //调用支付成功事件 @@ -862,7 +862,7 @@ class Order extends BaseModel - public static function buildCode($order){ + public static function buildCode($order,$people=[]){ if(is_string($order)||is_numeric($order))$order = self::getNopayOrder($order); $num = $order['num']; @@ -872,6 +872,12 @@ class Order extends BaseModel "status" =>'3', "activity_id"=>$order['activity_id'], ]; + if($people && isset($people[$i])){ + $params["name"] = $people[$i]["name"]; + $params["idnum"] = $people[$i]["idnum"]; + } + + $orderCode = OrderCode::create($params); $orderCode["code"] = en_code($orderCode["id"]); $orderCode["miniurl"] = self::getMiniQrcodeLink(["order_id"=>$order['id'],"code"=>$orderCode["code"]]); @@ -1017,6 +1023,8 @@ class Order extends BaseModel //组装订单数据 compact('order_data','activity_info','user_data',"activity_info"); $order_data = $order_info['order_data']; $order_data["order_no"] = $order_no; + $order_data["desc"] = $param["desc"] ?? $remark; + $res1 = self::create($order_data); if (!$res1) throw new \Exception('创建订单失败'); @@ -1056,6 +1064,11 @@ class Order extends BaseModel //记录订单日志 OrderLog::log($res1['id'],"活动订单创建成功,等待下一步操作(如果付费需去支付)",'user',$user_id); + + + //生成订单一维码和二维码 + $order = self::buildCode($res1['id'], $param["people"] ?? [] ); + //7事件 $data = ['order' => self::where("id",$res1['id'])->find()]; \think\Hook::listen('activity_order_create_after', $data); diff --git a/application/common/model/user/withdrawal/Userwithdrawal.php b/application/common/model/user/withdrawal/Userwithdrawal.php index 0f10e26..52858ff 100644 --- a/application/common/model/user/withdrawal/Userwithdrawal.php +++ b/application/common/model/user/withdrawal/Userwithdrawal.php @@ -75,8 +75,9 @@ class Userwithdrawal extends BaseModel //) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户银行卡绑定'; //这里应对基础提交信息做验证:开户行名称bank_name,转账账户名name,银行账户号bank_user_name,身份证号id_number //以下对每个字段做验证,如果验证不通过,则抛出异常 - + $params["user_id"] = $user_id; $rule = [ + 'user_id'=>'require', 'bank_name'=>'require', 'name'=>'require', 'bank_user_name'=>'require', @@ -84,7 +85,9 @@ class Userwithdrawal extends BaseModel ]; + $rule_msg = [ + 'user_id.require'=>'用户不能为空', 'bank_name.require'=>'开户行名称不能为空', 'name.require'=>'转账账户名不能为空', 'bank_user_name.require'=>'银行账户号不能为空', diff --git a/application/common/model/user/withdrawal/UserwithdrawalLog.php b/application/common/model/user/withdrawal/UserwithdrawalLog.php index 255168d..b06b1fd 100644 --- a/application/common/model/user/withdrawal/UserwithdrawalLog.php +++ b/application/common/model/user/withdrawal/UserwithdrawalLog.php @@ -142,8 +142,8 @@ class UserwithdrawalLog extends BaseModel } } - if (isset($whereData['status'])) $model = $model->where("{$alisa}status", 'in', $whereData['status']); - if (isset($whereData['not_status'])) $model = $model->where("{$alisa}status", 'not in', $whereData['not_status']); + if (isset($whereData['status']) && $whereData['status']!=="" && $whereData['status']!==null) $model = $model->where("{$alisa}status", 'in', $whereData['status']); + if (isset($whereData['not_status']) && $whereData['not_status']!=="" && $whereData['not_status']!==null) $model = $model->where("{$alisa}status", 'not in', $whereData['not_status']); if (isset($whereData['withdrawal_status']) && $whereData['withdrawal_status']!=="") $model = $model->where("{$alisa}withdrawal_status", 'in', $whereData['withdrawal_status']); if (isset($whereData['not_withdrawal_status'])&& $whereData['not_withdrawal_status']!=="") $model = $model->where("{$alisa}withdrawal_status", 'not in', $whereData['not_withdrawal_status']); @@ -258,7 +258,7 @@ class UserwithdrawalLog extends BaseModel if($trans){ self::rollbackTrans(); } - throw new \Exception($e->getMessage().$e->getFile().$e->getLine()); + throw new \Exception($e->getMessage()); } return $res; } diff --git a/application/index/controller/Cardocr.php b/application/index/controller/Cardocr.php new file mode 100644 index 0000000..11b4050 --- /dev/null +++ b/application/index/controller/Cardocr.php @@ -0,0 +1,65 @@ +assignconfig("title", __("Tencent Identity Card Network Authentication")); + } + + /** + * + * @return string + */ + public function index() + { + } + + /** 身份证验证页面 + * @return string + * @throws Exception + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\ModelNotFoundException + * @throws \think\exception\DbException + */ + public function docard() + { + $user_id = $this->auth->id; + $data = \addons\cardocr\model\Cardocr::where('user_id', '=', $user_id)->find(); + $data = isset($data) ? $data->toArray() : array(); + $status = isset($data['status']) ? $data['status'] : 0; + + $username = isset($data['name']) ? Card::hidestr($data['name'], 0, -1) : ""; + + $idnum = isset($data['idnum']) ? Card::hidestr($data['idnum'], 5, 9) : ""; + $positive_img = isset($data['positive_img']) ? $data['positive_img'] : ""; + $back_img = isset($data['back_img']) ? $data['back_img'] : ""; + + $this->view->assign("status", $status); + $this->view->assign("name", $username); + $this->view->assign("idnum", $idnum); + $this->view->assign("positive_img", $positive_img); + $this->view->assign("back_img", $back_img); + $this->assignconfig('checkstatus', $status); + return $this->view->fetch(); + } + + + +} diff --git a/application/index/lang/zh-cn/cardocr.php b/application/index/lang/zh-cn/cardocr.php new file mode 100644 index 0000000..e28bd40 --- /dev/null +++ b/application/index/lang/zh-cn/cardocr.php @@ -0,0 +1,14 @@ + '实名认证', + 'positive-img' => '身份证正面', + 'back-img' => '身份证反面', + 'Username' => '姓名', + 'IdCard' => '身份证号码', + 'Identification' => '身份证实名', + 'Tencent Identity Card Network Authentication'=>'腾讯身份证联网认证', + 'Validdatestart' => '有效期开始', + 'Validdateend' => '有效期结束', + 'Sex' => '性别', + 'IsthroughAPI'=>'是否人工审核' +]; diff --git a/application/index/view/cardocr/docard.html b/application/index/view/cardocr/docard.html new file mode 100644 index 0000000..ef29b49 --- /dev/null +++ b/application/index/view/cardocr/docard.html @@ -0,0 +1,256 @@ + +
          +
          +
          + {include file="common/sidenav" /} +
          +
          +
          +
          + +
          + {:token()} + + {switch name="status"} + {case value="null"} +
          + + 申请审核身份证! +
          +
          + +
          + +
          +
          +
          + +
          + +
          +
          + +
          + +
          +
          + +
          + + +
          +
          +
            +
            +
            +
            + +
            +
            + +
            + + +
            +
            +
              +
              +
              + + + {/case} + + {case value="0"} + +
              + + 拒绝审核身份证! +
              +
              + +
              + +
              +
              +
              + +
              + +
              +
              + + {/case} + + + {case value="1"} +
              + + 已经审核身份证! +
              +
              + +
              + +
              +
              +
              + +
              + +
              +
              + + {/case} + + + {case value="2"} +
              + + 等待审核身份证! +
              +
              + +
              + +
              +
              +
              + +
              + +
              +
              + + + + {/case} + + + + {default /} + + {/switch} + +
              +
              +
              +
              +
              +
              + + + \ No newline at end of file diff --git a/public/assets/js/backend/cardocr/card.js b/public/assets/js/backend/cardocr/card.js new file mode 100644 index 0000000..3e46cf1 --- /dev/null +++ b/public/assets/js/backend/cardocr/card.js @@ -0,0 +1,119 @@ +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { + + var Controller = { + index: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + index_url: 'cardocr/card/index' + location.search, + add_url: 'cardocr/card/add', + edit_url: 'cardocr/card/edit', + del_url: 'cardocr/card/del', + multi_url: 'cardocr/card/multi', + table: 'cardocr', + } + }); + + var table = $("#table"); + + // 初始化表格 + table.bootstrapTable({ + url: $.fn.bootstrapTable.defaults.extend.index_url, + pk: 'id', + sortName: 'id', + columns: [ + [ + {checkbox: true}, + {field: 'id', title: __('Id')}, + {field: 'user_id', title: __('User_id')}, + {field: 'user.nickname', title: __('User.nickname')}, + {field: 'name', title: __('Name')}, + { + field: 'sex', + title: __('Sex'), + searchList: {"男": __('男'), "女": __('女'), "未知": __('未知')}, + formatter: Table.api.formatter.normal + }, + {field: 'nation', title: __('Nation')}, + {field: 'birth', title: __('Birth'), operate: 'RANGE', addclass: 'datetimerange'}, + {field: 'address', title: __('Address')}, + {field: 'idnum', title: __('Idnum')}, + {field: 'authority', title: __('Authority')}, + { + field: 'validdatestart', + title: __('Validdatestart'), + operate: 'RANGE', + addclass: 'datetimerange' + }, + {field: 'validdateend', title: __('Validdateend'), operate: 'RANGE', addclass: 'datetimerange'}, + { + field: 'status', + title: __('Status'), + formatter: Table.api.formatter.status, + searchList: {"2": __("Unaudited"), "1": __('Pass'), "0": __('Down')} + }, + { + field: 'positive_img', + title: __('Positive_img'), + events: Table.api.events.image, + formatter: Table.api.formatter.image, + operate: false + }, + { + field: 'back_img', + title: __('Back_img'), + events: Table.api.events.image, + formatter: Table.api.formatter.image, + operate: false + }, + {field: 'memo', title: __('Memo')}, + { + field: 'createtime', + title: __('Createtime'), + operate: 'RANGE', + addclass: 'datetimerange', + formatter: Table.api.formatter.datetime + }, + { + field: 'updatetime', + title: __('Updatetime'), + operate: 'RANGE', + addclass: 'datetimerange', + formatter: Table.api.formatter.datetime + }, + { + field: 'publishtime', + title: __('Publishtime'), + operate: 'RANGE', + addclass: 'datetimerange', + formatter: Table.api.formatter.datetime + }, + { + field: 'operate', + title: __('Operate'), + table: table, + events: Table.api.events.operate, + formatter: Table.api.formatter.operate + } + ] + ] + }); + + // 为表格绑定事件 + Table.api.bindevent(table); + }, + add: function () { + // Controller.api.bindevent(); + Form.api.bindevent($("form[role=form]")); + }, + edit: function () { + Controller.api.bindevent(); + }, + api: { + bindevent: function () { + Form.api.bindevent($("form[role=form]")); + } + } + }; + return Controller; +}); \ No newline at end of file diff --git a/public/assets/js/backend/school/activity/join.js b/public/assets/js/backend/school/activity/join.js new file mode 100644 index 0000000..7a6cf05 --- /dev/null +++ b/public/assets/js/backend/school/activity/join.js @@ -0,0 +1,58 @@ +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { + + var Controller = { + index: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + index_url: 'school/activity/join/index' + location.search, + add_url: 'school/activity/join/add', + edit_url: 'school/activity/join/edit', + del_url: 'school/activity/join/del', + multi_url: 'school/activity/join/multi', + import_url: 'school/activity/join/import', + table: 'school_activity_join', + } + }); + + var table = $("#table"); + + // 初始化表格 + table.bootstrapTable({ + url: $.fn.bootstrapTable.defaults.extend.index_url, + pk: 'id', + sortName: 'id', + columns: [ + [ + {checkbox: true}, + {field: 'id', title: __('Id')}, + {field: 'user_id', title: __('User_id')}, + {field: 'name', title: __('Name'), operate: 'LIKE'}, + {field: 'idnum', title: __('Idnum'), operate: 'LIKE'}, + {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, + {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, + {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'}, + {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'}, + {field: 'user.avatar', title: __('User.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image}, + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} + ] + ] + }); + + // 为表格绑定事件 + Table.api.bindevent(table); + }, + add: function () { + Controller.api.bindevent(); + }, + edit: function () { + Controller.api.bindevent(); + }, + api: { + bindevent: function () { + Form.api.bindevent($("form[role=form]")); + } + } + }; + return Controller; +}); diff --git a/public/assets/js/frontend/cardocr.js b/public/assets/js/frontend/cardocr.js new file mode 100644 index 0000000..8d4d82a --- /dev/null +++ b/public/assets/js/frontend/cardocr.js @@ -0,0 +1,39 @@ +define(['jquery', 'bootstrap', 'frontend', 'form', 'template'], function ($, undefined, Frontend, Form, Template) { + + var Controller = { + docard: function () { + $("title").html(Config.title); + if (Config.checkstatus == 1) { + $("#username").attr("disabled", true); + $("#idnum").attr("disabled", true); + + } + + Form.api.bindevent($("form[role=form]"), function (data, ret) { + + if (ret.result == 0) { + Toastr.success(ret.msg); + location.reload(); + } else { + Toastr.error(ret.msg); + } + + return false; + }, function (success, error) { + //错误提示码 + // return false; + + }, function () { + + //已验证的身份证禁止提交表单 + if (Config.checkstatus == 1) { + return false; + } + + }); + + }, + + }; + return Controller; +}); \ No newline at end of file