Jelajahi Sumber

修改初审表格字段 ,上传短信功能

sandm 2 tahun lalu
induk
melakukan
5eca92a2f8

+ 99 - 0
app/admin/controller/MessageRecord.php

@@ -0,0 +1,99 @@
+<?php
+
+namespace app\admin\controller;
+
+use app\admin\common\AdminController;
+use app\common\api\ChuanglanSmsApi;
+use app\common\api\MessageRecordApi;
+use app\common\model\MessageRecord as MessageRecordModel;
+
+class MessageRecord extends AdminController {
+
+    public function index() {
+        return view();
+    }
+
+    /**
+     * 短信日志列表数据
+     * @return \think\response\Json
+     */
+    public function list(){
+        $res = MessageRecordApi::getList($this->request->param());
+        return json($res);
+    }
+
+    public function sendMessage(){
+        $content = trim($this->request['content']);
+        $title = trim($this->request['title']);
+        $time_day = date("Ymd",time());
+        if(\StrUtil::isEmpOrNull($content)){
+            return json(["msg" => '请填写信息后发送!']);
+        }
+        $phone_str = trim($this->request['params']);
+        $phone_arr = explode(',',$phone_str);
+        $template = "【晋江市人才服务平台】{$content}";
+        $bizId = getStringId();
+        foreach ($phone_arr as $k => $v){
+            if (!preg_match("/^1[3456789]\d{9}$/", $v)) {
+                unset($phone_arr[$k]);
+                continue;
+            }
+            $id = getStringId();
+            $item = [
+                'id' => $id,
+                'userId' => null,
+                'bizId' => $bizId,
+                'type' => 2,
+                'smsType' => 2,
+                'name' => "批量发送({$title}{$time_day})",
+                'phone' => $v,
+                "params" => $v,
+                "templateCode" => $template,
+                'state' => 3,
+                'sendingDate' => date("Y-m-d H:i:s",time()),
+                'createTime' => date("Y-m-d H:i:s",time())
+            ];
+            MessageRecordModel::create($item);
+        }
+
+        $smsapi = new ChuanglanSmsApi();
+
+        $result = $smsapi->sendSMS(implode(',',$phone_arr), $template, true);
+
+        $result = json_decode($result, true);
+
+        if($result['code'] != 0 || !$result){
+            return json(["msg" => '发送失败,原因:'.$result['errorMsg']]);
+        }
+
+        return json(["msg" => '操作成功(但不代表发送成功)'], 200);
+    }
+
+    public function resendMessage(){
+        $messageRecordId = $this->request['messageRecordId'];
+        if(empty($messageRecordId)){
+            return json(["msg" => '请选择重新发送的记录']);
+        }
+        $message = \app\common\model\MessageRecord::where('id',$messageRecordId)->findOrEmpty();
+        if(!$message || empty($message)){
+            return json(["msg" => '找不到重发记录']);
+        }
+        if($message['state']!=2){
+            return json(["msg" => '当前记录未发送失败,无法重发']);
+        }
+
+        $smsapi = new ChuanglanSmsApi();
+
+        $result = $smsapi->sendSMS($message['phone'], $message['templateCode'], true);
+
+        $result = json_decode($result, true);
+
+        if($result['code'] != 0 || !$result){
+            return json(["msg" => '发送失败,原因:'.$result['errorMsg']]);
+        }
+
+        return json(["msg" => '操作成功(但不代表发送成功)'], 200);
+    }
+
+
+}

+ 17 - 0
app/admin/model/MessageRecord.php

@@ -0,0 +1,17 @@
+<?php
+
+/**
+ * Description of Notice
+ *
+ * @author sgq
+ */
+
+namespace app\admin\model;
+
+use think\Model;
+
+class MessageRecord extends Model {
+
+    protected $table = "sys_message_record";
+
+}

+ 97 - 0
app/admin/view/message_record/index.html

@@ -0,0 +1,97 @@
+{extend name="layout/content"}
+{block name="content"}
+<div class="row">
+    <div class="col-sm-12">
+        <div class="ibox float-e-margins">
+            <div class="ibox-title">
+                <h5>短信管理</h5>
+            </div>
+            <div class="ibox-content">
+                <div class="row row-lg">
+                    <div class="col-sm-12">
+                        <div class="row">
+                            <div class="col-sm-3">
+                                <div class="input-group input-group-sm">
+                                    <div class="input-group-btn">
+                                        <button data-toggle="dropdown" class="btn btn-white dropdown-toggle"
+                                                type="button">姓名
+                                        </button>
+                                    </div>
+                                    <input type="text" class="form-control" id="name" placeholder="" />
+                                </div>
+                            </div>
+                            <div class="col-sm-3">
+                                <div class="input-group input-group-sm">
+                                    <div class="input-group-btn">
+                                        <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button">
+                                            发送对象
+                                        </button>
+                                    </div>
+                                    <select class="form-control" id="type">
+                                        <option value="">请选择</option>
+                                        <option value="1">管理员</option>
+                                        <option value="2">用户</option>
+                                    </select>
+                                </div>
+                            </div>
+                            <div class="col-sm-3">
+                                <div class="input-group input-group-sm">
+                                    <div class="input-group-btn">
+                                        <button data-toggle="dropdown" class="btn btn-white dropdown-toggle"
+                                                type="button">手机号码
+                                        </button>
+                                    </div>
+                                    <input type="text" class="form-control" id="phone" placeholder="" />
+                                </div>
+                            </div>
+                            <div class="col-sm-3">
+                                <div class="input-group input-group-sm">
+                                    <div class="input-group-btn">
+                                        <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button">
+                                            发送状态
+                                        </button>
+                                    </div>
+                                    <select class="form-control" id="state">
+                                        <option value="">请选择</option>
+                                        <option value="1">等待回执</option>
+                                        <option value="2">发送失败</option>
+                                        <option value="3">发送成功</option>
+                                    </select>
+                                </div>
+                            </div>
+                            <div class="col-sm-3">
+                                <button type="button" class="btn btn-sm btn-primary" onclick="MessageRecord.search()">
+                                    <i class="fa fa-search"></i>&nbsp;搜索
+                                </button>
+                            </div>
+                        </div>
+                        <div class="hidden-xs" id="MessageRecordTableToolbar" role="group">
+                            {if condition="chkCommission('/admin/MessageRecord/add','/MessageRecord/add')"}
+                            <button type="button" class="btn btn-sm btn-primary" onclick="MessageRecord.showSendMessageModal()">
+                                <i class="fa fa-plus"></i>&nbsp;发送短信
+                            </button>
+                            {/if}
+                            {if condition="chkCommission('/admin/MessageRecord/edit','/MessageRecord/update')"}
+                            <button type="button" class="btn btn-sm btn-primary" onclick="MessageRecord.resendMessage()">
+                                <i class="fa fa-edit"></i>&nbsp;重新发送
+                            </button>
+                            {/if}
+                            <button type="button" class="btn btn-sm btn-primary" onclick="MessageRecord.export()">
+                                <i class="fa fa-hand-o-up"></i>&nbsp;导出
+                            </button>
+                        </div>
+                        <table id="MessageRecordTable" class="table-condensed" style="font-size: 10px;table-layout: fixed!important;" data-mobile-responsive="true" data-click-to-select="true">
+                            <thead>
+                            <tr>
+                                <th data-field="selectItem" data-checkbox="true"></th>
+                            </tr>
+                            </thead>
+                        </table>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<script src="/static/modular/system/messageRecord/messageRecord.js"></script>
+{/block}

+ 38 - 0
app/common/api/MessageRecordApi.php

@@ -0,0 +1,38 @@
+<?php
+
+namespace app\common\api;
+
+use app\common\model\MessageRecord;
+
+class MessageRecordApi {
+
+    public static function getList($params = []) {
+        $where = [];
+        $name = $params["name"];
+        $phone = $params["phone"];
+        $type = $params["type"];
+        $state = $params["state"];
+        $order = $params["order"] ?: "desc";
+        $offset = $params["offset"] ?: 0;
+        $limit = $params["limit"] ?: 10;
+        if ($name) {
+            $where[] = ["name", "like", "%{$name}%"];
+        }
+        if($phone){
+            $where[] = ["phone", "like", "%{$phone}%"];
+        }
+        if($type){
+            $where[] = ["type", "=", "{$type}"];
+        }
+        if($state){
+            $where[] = ["type", "=", "{$state}"];
+        }
+        $count = MessageRecord::whereOr($where)->count();
+        $list = MessageRecord::whereOr($where)
+            ->order(["createTime" => $order])
+            ->limit($offset, $limit)
+            ->select()->toArray();
+        return ["total" => $count, "rows" => $list];
+    }
+}
+

+ 39 - 0
app/common/controller/Auth.php

@@ -9,9 +9,12 @@ use app\common\model\MessageRecord;
 use app\common\model\TalentChecklog;
 use think\facade\Cache;
 use app\common\validate\Enterprise;
+use app\common\validate\Person;
 use think\exception\ValidateException;
 use think\facade\Request;
 use app\common\api\UploadApi;
+use app\enterprise\model\Talent;
+use app\common\api\TalentState;
 
 class Auth extends BaseController {
 
@@ -633,4 +636,40 @@ class Auth extends BaseController {
         }
     }
 
+    public function person_register(){
+        $source = intval($this->request['source']);
+        $response_object = new \StdClass();
+        $data = [
+            'username' => \StrUtil::getRequestDecodeParam($this->request, 'username'),
+            'password' => \StrUtil::getRequestDecodeParam($this->request, 'password'),
+            'name' => \StrUtil::getRequestDecodeParam($this->request, 'name'),
+            'idCard' => \StrUtil::getRequestDecodeParam($this->request, 'idCard'),
+            'sex' => \StrUtil::getRequestDecodeParam($this->request, 'sex'),
+            'phone' => \StrUtil::getRequestDecodeParam($this->request, 'phone'),
+            'verificationCode' => \StrUtil::getRequestDecodeParam($this->request, 'verificationCode'),
+        ];
+        try {
+            validate(Person::class)->batch(true)->check($data);
+            //检验验证码
+            $codeResult = MessageRecord::where('smsType', 1)->where('phone', $data['phone'])->order('createTime', 'desc')->find();
+            if (!$codeResult) {
+                return json(['msg'=>'请先发送验证码']);
+            }
+
+            $info = Talent::where('idCard',$data['idCard'])->where('checkState',TalentState::CERTIFICATED)->findOrEmpty();
+            if(!$info){
+                return json(['msg'=>'人才库中不存在该证件号码,注册失败']);
+            }
+
+
+
+
+        } catch (ValidateException $e) {
+            $error = $e->getError();
+            return json(['msg'=>array_pop($error)]);
+        }
+
+
+    }
+
 }

+ 11 - 0
app/common/model/Person.php

@@ -0,0 +1,11 @@
+<?php
+namespace app\common\model;
+
+use think\Model;
+
+class Person extends Model{
+
+    protected $table = "un_person";
+
+
+}

+ 45 - 0
app/common/validate/Person.php

@@ -0,0 +1,45 @@
+<?php
+
+namespace app\common\validate;
+
+use think\Validate;
+use app\common\model\Person as PersonModel;
+
+class Person extends Validate {
+
+    protected $rule = [
+        'username' => 'require|max:50|unique:un_person',
+        'password' => 'require',
+        'name' => 'require|max:100',
+        'idCard' => 'require|idCard|unique:un_person',
+        'sex' => 'require',
+        'phone' => 'require|mobile|unique:un_person',
+        'verificationCode' => 'require'
+    ];
+    protected $message = [
+        'username.require' => '请填写账号!',
+        'username.max' => '账号最多50个字符!',
+        'username.unique' => '该账号已被注册',
+        'password.require' => '请填写密码!',
+        'name.require' => '请输入姓名',
+        'name.max' => '姓名最多100个字符!',
+        'idCard.require' => '请填写身份证!',
+        'idCard.idCard' => '请填写正确的身份证!',
+        'idCard.unique' => '该身份证已存在',
+        'sex.require' => '性别必须选择',
+        'phone.require' => '请填写手机号',
+        "phone.mobile" => "请填写正确的手机号",
+        'phone.unique' => '该手机号已存在',
+        'verificationCode.require' => '请输入手机验证码'
+    ];
+
+    protected function checkID($value,$rule,$data=[]){
+        $info = PersonModel::where('idCard',$value)->where('active',1)->where('id','<>',$data['id'])->find();
+        if($info){
+            return "该身份证已存在";
+        }else{
+            return true;
+        }
+    }
+
+}

+ 1 - 1
app/common/view/auth/register.html

@@ -35,7 +35,7 @@
                     <div class="tabs-container">
                         <ul class="nav nav-tabs">
                             <li class="active" regType="en" id="enTab"><a data-toggle="tab" href="#tab-1" aria-expanded="true">机构用户注册</a></li>
-                            <!--                            <li class="" regType="ps" id="personTab" ><a data-toggle="tab" href="#tab-2"   aria-expanded="false">个人用户注册</a></li>-->
+                            <li class="" regType="ps" id="personTab" ><a data-toggle="tab" href="#tab-2"   aria-expanded="false">个人用户注册</a></li>
                         </ul>
                         <div class="tab-content">
                             <div id="tab-1" class="tab-pane active">

+ 1 - 1
public/static/js/register.js

@@ -593,7 +593,7 @@ Register.personUserRegister = function () {
         return;
     }
     var da = {"source": source, "username": username, "password": password, "name": name, "sex": sex, "idCard": idCard, "phone": phone, "verificationCode": verificationCode};
-    var ajax = new $ax(Feng.ctxPath + "/api/personalUser/register", function (data) {
+    var ajax = new $ax("/common/auth/person_register", function (data) {
         Feng.info(data.msg);
         if (data.code == 200) {
             parent.layer.close(window.parent.Login.layerIndex);

+ 5 - 3
public/static/modular/talentIdentify/talentInfo/talentInfo_base.js

@@ -21,7 +21,7 @@ TalentInfo.initColumn = function () {
     return [
         {field: 'selectItem', checkbox: true},
         {title: '企业名称', field: 'enterprise_name', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "120px"},
-        {title: '姓名', field: 'name', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "120px",
+        {title: '姓名', field: 'name', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "100px",
             formatter: function (value, row, index) {
                 if (row.sex == 1) {
                     return value + '<span style="color:#6495ED">【男】</span>';
@@ -31,9 +31,11 @@ TalentInfo.initColumn = function () {
                 }
             }
         },
-        {title: '人才申报类型', field: 'talent_type', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "120px"},
+        // {title: '人才申报类型', field: 'talent_type', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "120px"},
         {title: '单位标签', field: 'enterprise_tag', visible: isShow, align: 'center', valign: 'middle', width: "120px", 'class': 'uitd_showTip'},
-        {title: '证件号码', field: 'card_number', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "150px"},
+        {title: '证件号码', field: 'card_number', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "120px"},
+        {title: '认定层次', field: 'talentArrangeName', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "80px"},
+        {title: '认定条件', field: 'talentConditionName', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "150px"},
         {title: '首次提交时间', field: 'first_submit_time', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "100px"},
         {title: '最新提交时间', field: 'new_submit_time', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "100px"},
         {title: '审核状态', field: 'checkState', visible: true, align: 'center', valign: 'middle', width: "100px",