Преглед изворни кода

Merge commit '522160fd14ff3cb392ba9b8246e7ae73c8f52231' into prod-v1

Mark пре 1 година
родитељ
комит
233cae61ce

+ 76 - 0
dyu/application/common/enum/dtalk/RobotSence.php

@@ -0,0 +1,76 @@
+<?php
+
+namespace app\common\enum\dtalk;
+
+use app\common\enum\EnumBasics;
+
+/**
+ * 基金动账类型
+ *
+ * @Author Mark
+ * @DateTime 2024-05-07
+ */
+class RobotSence extends EnumBasics
+{
+
+    /**
+     * 电影订单出票延迟
+     *
+     * @var int
+     */
+    const MOVIE_ORDER_DRAW_DEALY = 10;
+
+    /**
+     * 订单待处理
+     */
+    const ORDER_WAIT_DEAL = 20;
+
+    /**
+     * 充值提醒
+     *
+     * @var int
+     */
+    const RECHARGE_REMIND = 30;
+
+    /**
+     * 财务提醒
+     */
+    const FINANCE_REMIND = 40;
+
+
+	/**
+	 * 水印审核提醒
+	 */
+	const WATERMARK_APPLY = 50;
+
+    /**
+     * 获取枚举数据
+     *
+     * @return array
+     */
+    public static function data()
+    {
+        return [
+            self::MOVIE_ORDER_DRAW_DEALY      => [
+                'name'  => '电影订单出票延迟',
+                'value' => self::MOVIE_ORDER_DRAW_DEALY,
+            ],
+            self::ORDER_WAIT_DEAL      => [
+                'name'  => '订单待处理',
+                'value' => self::ORDER_WAIT_DEAL,
+            ],
+            self::RECHARGE_REMIND     => [
+                'name'  => '充值提醒',
+                'value' => self::RECHARGE_REMIND,
+            ],
+            self::FINANCE_REMIND     => [
+                'name'  => '财务提醒',
+                'value' => self::FINANCE_REMIND,
+            ],
+            self::WATERMARK_APPLY     => [
+	            'name'  => '水印审核提醒',
+	            'value' => self::WATERMARK_APPLY,
+            ],
+        ];
+    }
+}

+ 182 - 0
dyu/application/common/library/dtalk/Robot.php

@@ -0,0 +1,182 @@
+<?php
+
+namespace app\common\library\dtalk;
+
+use app\common\exception\BaseException;
+use GuzzleHttp\Command\Guzzle\GuzzleClient;
+use GuzzleHttp\Psr7\Request;
+use GuzzleHttp\Client;
+
+/**
+ * 钉钉机器人
+ *
+ * @Author Mark
+ * @DateTime 2024-08-09
+ */
+class Robot
+{
+    /**
+     * webhook 地址
+     *
+     * @var string
+     * @Author Mark
+     * @DateTime 2024-08-09
+     */
+    private $webhookURL = '';
+
+    /**
+     * 机器人密钥
+     *
+     * @var string
+     * @Author Mark
+     * @DateTime 2024-08-09
+     */
+    private $secret = '';
+
+    /**
+     * 发送的消息
+     *
+     * @var string
+     * @Author Mark
+     * @DateTime 2024-08-09
+     */
+    private $message = '';
+
+    /**
+     * at @ 的手机号
+     *
+     * @var array
+     * @Author Mark
+     * @DateTime 2024-08-09
+     */
+    private $atPhones = [];
+
+    /**
+     * 错误信息
+     *
+     * @var string
+     * @Author Mark
+     * @DateTime 2024-08-09
+     */
+    public $error = '';
+
+
+    public function __construct()
+    {
+    }
+
+    /**
+     * 设置错误信息
+     *
+     * @param string $error
+     * @return boolean
+     * @Author Mark
+     * @DateTime 2024-08-09
+     */
+    private function setError(string $error)
+    {
+        $this->error = $error;
+        return false;
+    }
+
+    /**
+     * 设置机器人accessTokne和secret
+     *
+     * @param string $webhookURL
+     * @param string $secret
+     * @return static
+     * @Author Mark
+     * @DateTime 2024-08-09
+     */
+    public function setWebhookAndSecret(string $webhookURL, string $secret)
+    {
+        $this->webhookURL = $webhookURL;
+        $this->secret = $secret;
+        return $this;
+    }
+
+    /**
+     * 设置消息
+     *
+     * @param string $message
+     * @return static
+     * @Author Mark
+     * @DateTime 2024-08-09
+     */
+    public function setMessage(string $message)
+    {
+        $this->message = $message;
+        return $this;
+    }
+
+    /**
+     * 设置 @的账号
+     *
+     * @param array $phones
+     * @return static
+     * @Author Mark
+     * @DateTime 2024-08-09
+     */
+    public function setAtPhones(array $phones)
+    {
+        $this->atPhones = $phones;
+        return $this;
+    }
+
+    /**
+     * 获取签名
+     *
+     * @param integer $timestamp
+     * @return string
+     * @Author Mark
+     * @DateTime 2024-08-09
+     */
+    private function getSign(int $timestamp): string
+    {
+        $string = hash_hmac('sha256', $timestamp . "\n" . $this->secret, $this->secret, true);
+        $sign = urlencode(base64_encode($string));
+        return $sign;
+    }
+
+    /**
+     * 发送消息
+     *
+     * @return boolean
+     * @Author Mark
+     * @DateTime 2024-08-09
+     */
+    public function sendMessage(): bool
+    {
+        $timestamp = time() * 1000;
+        $sign = $this->getSign($timestamp);
+        //发送内容
+        $content = [
+            'at' => [
+                'atMobiles' => $this->atPhones,
+            ],
+            'text' => [
+                'content' => $this->message,
+            ],
+            'msgtype' => 'text',
+        ];
+        $url = $this->webhookURL . "&timestamp={$timestamp}&sign={$sign}";
+        //发送请求
+        $client = new Client();
+        $options = [
+            'headers' => ['Content-Type' => 'application/json;charset=UTF-8'],
+            'json' => $content,
+            'verify'  => false
+        ];
+        $response = $client->request('POST', $url, $options);
+        //判断响应状态
+        $body = $response->getBody()->getContents();
+        $res = json_encode($body, true);
+        if (empty($res['errcode'])) {
+            return $this->setError('未知错误');
+        }
+        if ($res['errcode'] != 0) {
+            return $this->setError($res['errmsg']);
+        }
+        return true;
+    }
+}

+ 61 - 0
dyu/application/common/model/DtalkRobot.php

@@ -0,0 +1,61 @@
+<?php
+
+namespace app\common\model;
+
+use app\common\model\BaseModel;
+use think\db\Query;
+
+/**
+ * 钉钉机器人
+ *
+ * @Author Mark
+ * @DateTime 2024-08-09
+ */
+class DtalkRobot extends BaseModel
+{
+	protected $name = 'dtalk_robot';
+
+	/**
+	 * [detail]
+	 *
+	 * @Author: Yeshihao
+	 * @DateTime: 2024/8/9 17:26
+	 * @param $id
+	 * @return DtalkRobot|null
+	 * @throws \think\exception\DbException
+	 */
+	public static function detail($id)
+	{
+		return static::get($id);
+	}
+
+	/**
+	 * [handlerSearch]
+	 * 搜索器
+	 * @Author: Yeshihao
+	 * @DateTime: 2024/8/9 17:26
+	 * @param Query $query
+	 * @param array $param
+	 * @return Query
+	 */
+	public function handlerSearch(Query $query, array $param)
+	{
+		//应用名称
+		if (!empty($param['name'])) {
+			$query->where('name', 'like', "%".$param['name']."%");
+		}
+		return $query;
+	}
+
+
+	/**
+	 * 删除记录
+	 * @return int
+	 * @throws \think\Exception
+	 * @throws \think\exception\PDOException
+	 */
+	public function setDelete()
+	{
+		return $this->save(['is_delete' => 1]);
+	}
+}

+ 8 - 0
dyu/application/common/service/Basics.php

@@ -36,4 +36,12 @@ class Basics
         return !empty($this->error);
     }
 
+
+	public function setError($error)
+	{
+		$this->error = $error;
+		return false;
+	}
+
+
 }

+ 73 - 0
dyu/application/common/service/dtalk/robot/BaseRobot.php

@@ -0,0 +1,73 @@
+<?php
+
+namespace app\common\service\dtalk\robot;
+
+use app\common\enum\dtalk\RobotSence;
+use app\common\library\dtalk\Robot;
+use app\common\model\DtalkRobot;
+use app\common\service\Basics;
+
+/**
+ * 基础发送钉钉消息机器人
+ *
+ * @Author Mark
+ * @DateTime 2024-08-12
+ */
+class BaseRobot extends Basics
+{
+
+	/**
+	 * 构造函数
+	 *
+	 * @param integer $wxappId 小程序id
+	 * @param integer $sence 发送场景
+	 * @Author Mark
+	 * @DateTime 2024-08-12
+	 */
+	public function __construct(int $wxappId)
+	{
+		$this->wxappId = $wxappId;
+	}
+
+	/**
+	 * 获取机器人列表
+	 *
+	 * @return DtalkRobot[]
+	 * @Author Mark
+	 * @DateTime 2024-08-09
+	 */
+	private function getRobot(int $sence)
+	{
+		$where = [
+			'sence'     => $sence,
+			'is_delete' => 0,
+			'wxapp_id'  => $this->wxappId,
+		];
+		$robot = DtalkRobot::where($where)->select();
+		return $robot;
+	}
+
+	/**
+	 * 发送消息
+	 *
+	 * @param string  $content 发送的内容
+	 * @param integer $sence 发送场景
+	 * @return bool
+	 * @Author Mark
+	 * @DateTime 2024-08-12
+	 */
+	public function sendMessage(string $content, int $sence, array $phones = [])
+	{
+		$robotList = $this->getRobot($sence);
+		if (count($robotList) < 1) {
+			return $this->setError('未设置符合条件的机器人');
+		}
+		foreach ($robotList as $robot) {
+			$service = new Robot;
+			$service->setWebhookAndSecret($robot->webhook, $robot->secret);
+			$atPhones = $robot->at_phone ? explode('#', $robot->at_phone) : $phones;
+			$service->setMessage($content)->setAtPhones($atPhones)->sendMessage();
+		}
+		return true;
+	}
+}

+ 106 - 0
dyu/application/store/controller/setting/DtalkRobot.php

@@ -0,0 +1,106 @@
+<?php
+
+/**
+ *
+ * @copyright ©2020 点小铺
+ * @author  hanj
+ * @link: https://dyuit.com
+ * Created by VSCode
+ */
+
+namespace app\store\controller\setting;
+
+use app\common\enum\dtalk\RobotSence;
+use app\store\controller\Controller;
+use app\store\model\DtalkRobot as DtalkRobotModel;
+
+/**
+ * Class DtalkRobot
+ * 钉钉机器人
+ *
+ * @Author: Yeshihao
+ * @DateTime: 2024/8/9 17:28
+ * @package app\store\controller\setting
+ */
+class DtalkRobot extends Controller
+{
+	/**
+	 * [index]
+	 *
+	 * @Author: Yeshihao
+	 * @DateTime: 2024/8/9 17:28
+	 * @return mixed
+	 */
+	public function index()
+	{
+		$model = new DtalkRobotModel;
+		$list  = $model->getList();
+		$robotSence = RobotSence::data();
+		return $this->fetch('index', compact('list', 'robotSence'));
+	}
+
+
+	/**
+	 * [delete]
+	 * 删除
+	 *
+	 * @Author: Yeshihao
+	 * @DateTime: 2024/8/9 18:24
+	 * @param $id
+	 * @return array|bool
+	 * @throws \think\exception\DbException
+	 */
+	public function delete($id)
+	{
+		$model = DtalkRobotModel::detail($id);
+		if (!$model->setDelete()) {
+			return $this->renderError($model->getError() ?: '删除失败');
+		}
+		return $this->renderSuccess('删除成功');
+	}
+
+	/**
+	 * 添加配送模板
+	 *
+	 * @return array|mixed
+	 * @throws \think\Exception
+	 * @throws \think\exception\PDOException
+	 */
+	public function add()
+	{
+		if (!$this->request->isAjax()) {
+			$robotSence = RobotSence::data();
+			return $this->fetch('add', compact('robotSence'));
+		}
+		// 新增记录
+		$model = new DtalkRobotModel;
+		if ($model->add($this->postData())) {
+			return $this->renderSuccess('添加成功', url('setting.dtalk_robot/index'));
+		}
+		return $this->renderError($model->getError() ?: '添加失败');
+	}
+
+	/**
+	 * 编辑配送模板
+	 *
+	 * @param $delivery_id
+	 * @return array|mixed
+	 * @throws \think\Exception
+	 * @throws \think\exception\DbException
+	 * @throws \think\exception\PDOException
+	 */
+	public function edit($id)
+	{
+		// 模板详情
+		$model = DtalkRobotModel::detail($id);
+		if (!$this->request->isAjax()) {
+			$robotSence = RobotSence::data();
+			return $this->fetch('edit', compact('model', 'robotSence'));
+		}
+		// 更新记录
+		if ($model->edit($this->postData())) {
+			return $this->renderSuccess('更新成功');
+		}
+		return $this->renderError($model->getError() ?: '更新失败');
+	}
+}

+ 9 - 0
dyu/application/store/extra/menus.php

@@ -665,6 +665,15 @@ return [
 				'name'  => '上传设置',
 				'index' => 'setting/storage',
 			],
+			[
+				'name'  => '钉钉机器人',
+				'index' => 'setting.dtalk_robot/index',
+				'uris'  => [
+					'setting.dtalk_robot/index',
+					'setting.dtalk_robot/add',
+					'setting.dtalk_robot/edit'
+				]
+			],
 			[
 				'name'    => '小票打印机',
 				'submenu' => [

+ 10 - 0
dyu/application/store/model/CertificateApply.php

@@ -10,7 +10,9 @@
 
 namespace app\store\model;
 
+use app\common\enum\dtalk\RobotSence;
 use app\common\model\CertificateApply as CertificateApplyModel;
+use app\common\service\dtalk\robot\BaseRobot;
 use app\common\service\watermark\WaterMarkBase;
 
 /**
@@ -127,6 +129,14 @@ class CertificateApply extends CertificateApplyModel
 			$data['result_data'] = $result_data;
 		}
 
+		//发送失败通知给客服
+		$robot = new BaseRobot($this->wxapp_id);
+		if ($data['status'] == 20) {
+			$robot->sendMessage("资质申请:【{$this->project}】,审核成功。", RobotSence::WATERMARK_APPLY, [$this->storeUser->phone]);
+		}
+		if ($data['status'] == 30) {
+			$robot->sendMessage("资质申请:【{$this->project}】,审核失败,失败原因:{$data['refuse_reason']}。", RobotSence::WATERMARK_APPLY, [$this->storeUser->phone]);
+		}
 		//获取文件类型
 		$data['apply_user_id'] = getStoreUserId();
 		return $this->allowField(true)->save($data);

+ 61 - 0
dyu/application/store/model/DtalkRobot.php

@@ -0,0 +1,61 @@
+<?php
+
+namespace app\store\model;
+
+use app\common\model\DtalkRobot as DtalkRobotModel;
+
+/**
+ * 钉钉机器人
+ *
+ * @Author Mark
+ * @DateTime 2024-08-09
+ */
+class DtalkRobot extends DtalkRobotModel
+{
+	/**
+	 * [getList]
+	 * 获取机器人列表
+	 *
+	 * @Author: Yeshihao
+	 * @DateTime: 2024/8/12 9:45
+	 * @return \think\Paginator
+	 * @throws \think\exception\DbException
+	 */
+	public function getList()
+	{
+		$query = self::useGlobalScope(true);
+		$query = $this->handlerSearch($query, request()->param());
+		return $query->where('is_delete', '=', 0)
+			->order(['create_time' => 'desc'])
+			->paginate(15, false, ['query' => request()->request()]);
+	}
+
+
+	/**
+	 * [add]
+	 *
+	 * @Author: Yeshihao
+	 * @DateTime: 2024/8/12 9:53
+	 * @param $data
+	 * @return false|int
+	 */
+	public function add($data)
+	{
+		$data['wxapp_id'] = self::$wxapp_id;
+		return $this->allowField(true)->save($data);
+	}
+
+
+	/**
+	 * [edit]
+	 *
+	 * @Author: Yeshihao
+	 * @DateTime: 2024/8/12 9:54
+	 * @param $data
+	 * @return false|int
+	 */
+	public function edit($data)
+	{
+		return $this->allowField(true)->save($data);
+	}
+}

+ 1 - 0
dyu/application/store/model/store/User.php

@@ -199,6 +199,7 @@ class User extends StoreUserModel
         if ($this->save([
             'user_name' => $data['user_name'],
             'password' => dyu_hash($data['password']),
+            'phone' => $data['phone'],
         ]) === false) {
             return false;
         }

+ 71 - 0
dyu/application/store/view/setting/dtalk_robot/add.php

@@ -0,0 +1,71 @@
+<div class="row-content am-cf">
+    <div class="row">
+        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
+            <div class="widget am-cf">
+                <form id="my-form" class="am-form tpl-form-line-form" enctype="multipart/form-data" method="post">
+                    <div class="widget-body">
+                        <fieldset>
+                            <div class="widget-head am-cf">
+                                <div class="widget-title am-fl">新增钉钉机器人</div>
+                            </div>
+                            <div class="am-form-group">
+                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require"> 机器人名称 </label>
+                                <div class="am-u-sm-9 am-u-end">
+                                    <input type="text" class="tpl-form-input" name="name" value="" required>
+                                </div>
+                            </div>
+                            <div class="am-form-group">
+                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require"> webhook url地址 </label>
+                                <div class="am-u-sm-9 am-u-end">
+                                    <input type="text" class="tpl-form-input" name="webhook" value="" required>
+                                </div>
+                            </div>
+                            <div class="am-form-group">
+                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">密钥</label>
+                                <div class="am-u-sm-9 am-u-end">
+                                    <textarea type="password" class="tpl-form-input" name="secret" required></textarea>
+                                </div>
+                            </div>
+                            <div class="am-form-group">
+                                <label class="am-u-sm-3 am-u-lg-2 am-form-label"> @的手机号 </label>
+                                <div class="am-u-sm-9 am-u-end">
+                                    <input type="text" class="tpl-form-input" name="at_phone" value="">
+                                    <div class="help-block">
+                                        <small>注:如需填写多个手机号,可用英文逗号 <code>#</code> 隔开</small>
+                                    </div>
+                                </div>
+                            </div>
+                            <div class="am-form-group">
+                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">场景 </label>
+                                <div class="am-u-sm-9 am-u-end">
+                                    <?php foreach($robotSence as $sence):?>
+                                    <label class="am-radio-inline">
+                                        <input type="radio" name="sence" value="<?=$sence['value']?>" data-am-ucheck required><?=$sence['name']?>
+                                    </label>
+                                    <?php endforeach;?>
+                                </div>
+                            </div>
+                            <div class="am-form-group">
+                                <div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg">
+                                    <button type="submit" class="j-submit am-btn am-btn-secondary">提交
+                                    </button>
+                                </div>
+                            </div>
+                        </fieldset>
+                    </div>
+                </form>
+            </div>
+        </div>
+    </div>
+</div>
+<script>
+    $(function () {
+
+        /**
+         * 表单验证提交
+         * @type {*}
+         */
+        $('#my-form').superForm();
+
+    });
+</script>

+ 71 - 0
dyu/application/store/view/setting/dtalk_robot/edit.php

@@ -0,0 +1,71 @@
+<div class="row-content am-cf">
+    <div class="row">
+        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
+            <div class="widget am-cf">
+                <form id="my-form" class="am-form tpl-form-line-form" enctype="multipart/form-data" method="post">
+                    <div class="widget-body">
+                        <fieldset>
+                            <div class="widget-head am-cf">
+                                <div class="widget-title am-fl">编辑钉钉机器人</div>
+                            </div>
+                            <div class="am-form-group">
+                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require"> 机器人名称 </label>
+                                <div class="am-u-sm-9 am-u-end">
+                                    <input type="text" class="tpl-form-input" name="name" value="<?= $model['name'] ?>" required>
+                                </div>
+                            </div>
+                            <div class="am-form-group">
+                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require"> webhook url地址 </label>
+                                <div class="am-u-sm-9 am-u-end">
+                                    <input type="text" class="tpl-form-input" name="webhook" value="<?= $model['webhook'] ?>" required>
+                                </div>
+                            </div>
+                            <div class="am-form-group">
+                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">密钥</label>
+                                <div class="am-u-sm-9 am-u-end">
+                                    <textarea type="password" class="tpl-form-input" name="secret" required><?= $model['secret'] ?></textarea>
+                                </div>
+                            </div>
+                            <div class="am-form-group">
+                                <label class="am-u-sm-3 am-u-lg-2 am-form-label"> @的手机号 </label>
+                                <div class="am-u-sm-9 am-u-end">
+                                    <input type="text" class="tpl-form-input" name="at_phone" value="<?= $model['at_phone'] ?>">
+                                    <div class="help-block">
+                                        <small>注:如需填写多个手机号,可用英文逗号 <code>#</code> 隔开</small>
+                                    </div>
+                                </div>
+                            </div>
+                            <div class="am-form-group">
+                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">场景 </label>
+                                <div class="am-u-sm-9 am-u-end">
+                                    <?php foreach ($robotSence as $sence): ?>
+                                        <label class="am-radio-inline">
+                                            <input type="radio" name="sence" value="<?= $sence['value'] ?>" data-am-ucheck required <?= $model['sence'] == $sence['value'] ? 'checked' : '' ?>><?= $sence['name'] ?>
+                                        </label>
+                                    <?php endforeach; ?>
+                                </div>
+                            </div>
+                            <div class="am-form-group">
+                                <div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg">
+                                    <button type="submit" class="j-submit am-btn am-btn-secondary">提交
+                                    </button>
+                                </div>
+                            </div>
+                        </fieldset>
+                    </div>
+                </form>
+            </div>
+        </div>
+    </div>
+</div>
+<script>
+    $(function() {
+
+        /**
+         * 表单验证提交
+         * @type {*}
+         */
+        $('#my-form').superForm();
+
+    });
+</script>

+ 89 - 0
dyu/application/store/view/setting/dtalk_robot/index.php

@@ -0,0 +1,89 @@
+<div class="row-content am-cf">
+    <div class="row">
+        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
+            <div class="widget am-cf">
+                <div class="widget-head am-cf">
+                    <div class="widget-title am-cf">钉钉机器人</div>
+                </div>
+                <div class="widget-body am-fr">
+                    <div class="am-u-sm-12 am-u-md-6 am-u-lg-6">
+                        <div class="am-form-group">
+                            <div class="am-btn-toolbar">
+								<?php if (checkPrivilege('setting.dtalk_robot/add')): ?>
+                                    <div class="am-btn-group am-btn-group-xs">
+                                        <a class="am-btn am-btn-default am-btn-success am-radius"
+                                           href="<?= url('setting.dtalk_robot/add') ?>">
+                                            <span class="am-icon-plus"></span> 新增
+                                        </a>
+                                    </div>
+								<?php endif; ?>
+                            </div>
+                        </div>
+                    </div>
+                    <div class="am-u-sm-12">
+                        <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black ">
+                            <thead>
+                            <tr>
+                                <th>机器人ID</th>
+                                <th>机器人名称</th>
+                                <th>提醒手机号</th>
+                                <th>场景</th>
+                                <th>操作</th>
+                            </tr>
+                            </thead>
+                            <tbody>
+							<?php if (!$list->isEmpty()): ?>
+								<?php foreach ($list as $item): ?>
+                                    <tr>
+                                        <td class="am-text-middle"><?= $item['id'] ?></td>
+                                        <td class="am-text-middle"><?= $item['name'] ?></td>
+                                        <td class="am-text-middle"><?= $item['at_phone'] ?></td>
+                                        <td class="am-text-middle"><?= $item['sence'] ?></td>
+                                        <td class="am-text-middle">
+                                            <div class="tpl-table-black-operation">
+												<?php if (checkPrivilege('setting.dtalk_robot/edit')): ?>
+                                                    <a href="<?= url('setting.dtalk_robot/edit',
+														['id' => $item['id']]) ?>">
+                                                        <i class="am-icon-pencil"></i> 编辑
+                                                    </a>
+												<?php endif; ?>
+												<?php if (checkPrivilege('setting.dtalk_robot/delete')): ?>
+                                                    <a href="javascript:;"
+                                                       class="item-delete tpl-table-black-operation-del"
+                                                       data-id="<?= $item['id'] ?>">
+                                                        <i class="am-icon-trash"></i> 删除
+                                                    </a>
+												<?php endif; ?>
+                                            </div>
+                                        </td>
+                                    </tr>
+								<?php endforeach; ?>
+							<?php else: ?>
+                                <tr>
+                                    <td colspan="6" class="am-text-center">暂无记录</td>
+                                </tr>
+							<?php endif; ?>
+                            </tbody>
+                        </table>
+                    </div>
+                    <div class="am-u-lg-12 am-cf">
+                        <div class="am-fr"><?= $list->render() ?> </div>
+                        <div class="am-fr pagination-total am-margin-right">
+                            <div class="am-vertical-align-middle">总记录:<?= $list->total() ?></div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<script>
+    $(function () {
+
+        // 删除元素
+        var url = "<?= url('setting.dtalk_robot/delete') ?>";
+        $('.item-delete').delete('id', url);
+
+    });
+</script>
+

+ 7 - 0
dyu/application/store/view/store/user/add.php

@@ -49,6 +49,13 @@
                                            value="">
                                 </div>
                             </div>
+                            <div class="am-form-group">
+                                <label class="am-u-sm-3 am-u-lg-2 am-form-label">手机号 </label>
+                                <div class="am-u-sm-9 am-u-end">
+                                    <input type="number" class="tpl-form-input" name="user[phone]"
+                                           value="">
+                                </div>
+                            </div>
                             <div class="am-form-group">
                                 <div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg">
                                     <button type="submit" class="j-submit am-btn am-btn-secondary">提交

+ 7 - 0
dyu/application/store/view/store/user/edit.php

@@ -51,6 +51,13 @@
                                            value="<?= $model['real_name'] ?>">
                                 </div>
                             </div>
+                            <div class="am-form-group">
+                                <label class="am-u-sm-3 am-u-lg-2 am-form-label">手机号 </label>
+                                <div class="am-u-sm-9 am-u-end">
+                                    <input type="number" class="tpl-form-input" name="user[phone]"
+                                           value="<?= $model['phone'] ?>">
+                                </div>
+                            </div>
                             <div class="am-form-group">
                                 <div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg">
                                     <button type="submit" class="j-submit am-btn am-btn-secondary">提交

+ 2 - 0
dyu/application/store/view/store/user/index.php

@@ -27,6 +27,7 @@
                                 <th>管理员ID</th>
                                 <th>用户名</th>
                                 <th>姓名</th>
+                                <th>手机号</th>
                                 <th>添加时间</th>
                                 <th>操作</th>
                             </tr>
@@ -37,6 +38,7 @@
                                     <td class="am-text-middle"><?= $item['store_user_id'] ?></td>
                                     <td class="am-text-middle"><?= $item['user_name'] ?></td>
                                     <td class="am-text-middle"><?= $item['real_name'] ?></td>
+                                    <td class="am-text-middle"><?= $item['phone'] ?></td>
                                     <td class="am-text-middle"><?= $item['create_time'] ?></td>
                                     <td class="am-text-middle">
                                         <div class="tpl-table-black-operation">

+ 7 - 0
dyu/application/store/view/store/user/renew.php

@@ -29,6 +29,13 @@
                                            value="" required>
                                 </div>
                             </div>
+                            <div class="am-form-group">
+                                <label class="am-u-sm-3 am-form-label">手机号 </label>
+                                <div class="am-u-sm-9 am-u-end">
+                                    <input type="number" class="tpl-form-input" name="user[phone]"
+                                           value="<?= $model['phone'] ?>">
+                                </div>
+                            </div>
                             <div class="am-form-group">
                                 <div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg">
                                     <button type="submit" class="j-submit am-btn am-btn-secondary">提交