Преглед на файлове

Merge branch 'as-app-index'

bianjunhui преди 1 година
родител
ревизия
d56af9c5ab
променени са 39 файла, в които са добавени 2399 реда и са изтрити 1 реда
  1. 183 0
      application/admin/controller/Appindex.php
  2. 108 0
      application/admin/controller/Appindexdes.php
  3. 37 0
      application/admin/controller/sms/Log.php
  4. 156 0
      application/admin/controller/sms/Template.php
  5. 6 0
      application/admin/lang/zh-cn/appindex.php
  6. 5 0
      application/admin/lang/zh-cn/appindexdes.php
  7. 5 0
      application/admin/lang/zh-cn/sms/log.php
  8. 5 0
      application/admin/lang/zh-cn/sms/template.php
  9. 60 0
      application/admin/model/Appindex.php
  10. 48 0
      application/admin/model/Appindexdes.php
  11. 49 0
      application/admin/model/sms/Log.php
  12. 86 0
      application/admin/model/sms/Template.php
  13. 27 0
      application/admin/validate/Appindex.php
  14. 27 0
      application/admin/validate/Appindexdes.php
  15. 27 0
      application/admin/validate/sms/Log.php
  16. 27 0
      application/admin/validate/sms/Template.php
  17. 75 0
      application/admin/view/appindex/add.html
  18. 76 0
      application/admin/view/appindex/edit.html
  19. 39 0
      application/admin/view/appindex/index.html
  20. 67 0
      application/admin/view/appindexdes/add.html
  21. 67 0
      application/admin/view/appindexdes/edit.html
  22. 35 0
      application/admin/view/appindexdes/index.html
  23. 106 0
      application/admin/view/sms/log/add.html
  24. 106 0
      application/admin/view/sms/log/edit.html
  25. 34 0
      application/admin/view/sms/log/index.html
  26. 60 0
      application/admin/view/sms/template/add.html
  27. 53 0
      application/admin/view/sms/template/edit.html
  28. 45 0
      application/admin/view/sms/template/index.html
  29. 116 0
      application/api/common.php
  30. 162 0
      application/api/controller/Appindex.php
  31. 139 0
      application/api/controller/Assms.php
  32. 52 0
      application/common/model/Assms.php
  33. 36 0
      application/common/model/Coupon.php
  34. 31 0
      application/job/Sendsms.php
  35. 2 1
      composer.json
  36. 67 0
      public/assets/js/backend/appindex.js
  37. 56 0
      public/assets/js/backend/appindexdes.js
  38. 63 0
      public/assets/js/backend/sms/log.js
  39. 56 0
      public/assets/js/backend/sms/template.js

+ 183 - 0
application/admin/controller/Appindex.php

@@ -0,0 +1,183 @@
+<?php
+
+namespace app\admin\controller;
+
+use app\common\controller\Backend;
+use think\Db;
+use think\exception\DbException;
+use think\exception\PDOException;
+use think\exception\ValidateException;
+use app\common\model\Coupon;
+
+/**
+ * 
+ *
+ * @icon fa fa-circle-o
+ */
+class Appindex extends Backend
+{
+
+    /**
+     * Appindex模型对象
+     * @var \app\admin\model\Appindex
+     */
+    protected $model = null;
+
+    public function _initialize()
+    {
+        parent::_initialize();
+        $this->model = new \app\admin\model\Appindex;
+        $this->view->assign("statusList", $this->model->getStatusList());
+    }
+
+
+
+    /**
+     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
+     * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
+     * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+     */
+    /**
+     * 添加
+     *
+     * @return string
+     * @throws \think\Exception
+     */
+    public function add()
+    {
+        if (false === $this->request->isPost()) {
+            return $this->view->fetch();
+        }
+        $params = $this->request->post('row/a');
+        if (empty($params)) {
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        $params = $this->preExcludeFields($params);
+
+        if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
+            $params[$this->dataLimitField] = $this->auth->id;
+        }
+        $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()->validate($validate);
+            }
+            //$result = $this->model->allowField(true)->save($params);
+            $result = Db::name('appindex')->insertGetId($params);
+            if($params['showType']==1 || $params['showType']==4 ){
+                $send =new Coupon();
+                $re = $send->getProduct($params['link']);
+                $product=array();
+                if(isset($re['status'])&&$re['status']==1){
+                    $product =$re['data']['product'];
+                }
+                if($product){
+                    $new=array();
+                    foreach ($product as $k=>$v){
+                        $new[$k]['pid']=$result;
+                        $new[$k]['title']=$v['name'];
+                        $new[$k]['link']=$v['entity_id'];
+                        $new[$k]['type']=1;
+                        $new[$k]['oldPrice']=$v['price'];
+                        $new[$k]['nowPrice']=number_format($v['final_price'], 2);
+                        //$new[$k]['sale_num']=$v['sold'];
+                        $new[$k]['sort_order']=$k+1;
+                        $new[$k]['images']=$v['image'];
+                    }
+                    Db::name('appindexdes')->insertAll($new);
+                }else{
+                    Db::rollback();
+                    $this->error('该分类没产品!');
+                }
+            }
+            Db::commit();
+        } catch (ValidateException|PDOException|Exception $e) {
+            Db::rollback();
+            $this->error($e->getMessage());
+        }
+        if ($result === false) {
+            $this->error(__('No rows were inserted'));
+        }
+        $this->success();
+    }
+
+    /**
+     * 编辑
+     *
+     * @param $ids
+     * @return string
+     * @throws DbException
+     * @throws \think\Exception
+     */
+    public function edit($ids = null)
+    {
+        $row = $this->model->get($ids);
+        if (!$row) {
+            $this->error(__('No Results were found'));
+        }
+        $adminIds = $this->getDataLimitAdminIds();
+        if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
+            $this->error(__('You have no permission'));
+        }
+        if (false === $this->request->isPost()) {
+            $this->view->assign('row', $row);
+            return $this->view->fetch();
+        }
+        $params = $this->request->post('row/a');
+        if (empty($params)) {
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        $params = $this->preExcludeFields($params);
+        $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 . '.edit' : $name) : $this->modelValidate;
+                $row->validateFailException()->validate($validate);
+            }
+            $result = $row->allowField(true)->save($params);
+            if($row['showType']==1 ||$params['showType']==4){
+                Db::name('appindexdes')->where('pid',$ids)->delete();
+                $send =new Coupon();
+                $re = $send->getProduct($params['link']);
+                $product=array();
+                if(isset($re['status'])&&$re['status']==1){
+                    $product =$re['data']['product'];
+                }
+                if($product){
+                    $new=array();
+                    foreach ($product as $k=>$v){
+                        $new[$k]['pid']=$ids;
+                        $new[$k]['title']=$v['name'];
+                        $new[$k]['link']=$v['entity_id'];
+                        $new[$k]['type']=1;
+                        $new[$k]['oldPrice']=$v['base_price'];
+                        $new[$k]['nowPrice']=number_format($v['base_final_price'], 2);
+                        //$new[$k]['sale_num']=$v['sold'];
+                        $new[$k]['sort_order']=$k+1;
+                       // $new[$k]['images']='https://www.bilisar.com/media/catalog/product'.$v['image'];
+                        $new[$k]['images']=$v['image'];
+                    }
+                    Db::name('appindexdes')->insertAll($new);
+                }else{
+                    Db::rollback();
+                    $this->error('该分类没产品!');
+                }
+            }
+            Db::commit();
+        } catch (ValidateException|PDOException|Exception $e) {
+            Db::rollback();
+            $this->error($e->getMessage());
+        }
+        if (false === $result) {
+            $this->error(__('No rows were updated'));
+        }
+        $this->success();
+    }
+}

+ 108 - 0
application/admin/controller/Appindexdes.php

@@ -0,0 +1,108 @@
+<?php
+
+namespace app\admin\controller;
+
+use app\common\controller\Backend;
+use think\Db;
+use think\exception\PDOException;
+use think\exception\ValidateException;
+
+/**
+ * 
+ *
+ * @icon fa fa-circle-o
+ */
+class Appindexdes extends Backend
+{
+
+    /**
+     * Appindexdes模型对象
+     * @var \app\admin\model\Appindexdes
+     */
+    protected $model = null;
+
+    public function _initialize()
+    {
+        parent::_initialize();
+        $this->model = new \app\admin\model\Appindexdes;
+
+    }
+
+    public function index($ids=null)
+    {
+        $ids=input('ids');
+        if(empty($ids)){
+            $ids=session('despid');
+        }else{
+            session('despid',$ids);
+        }
+        //设置过滤方法
+        $this->request->filter(['strip_tags', 'trim']);
+        if (false === $this->request->isAjax()) {
+            return $this->view->fetch();
+        }
+        //如果发送的来源是 Selectpage,则转发到 Selectpage
+        if ($this->request->request('keyField')) {
+            return $this->selectpage();
+        }
+        [$where, $sort, $order, $offset, $limit] = $this->buildparams();
+        $dts['pid'] =$ids;
+        $list = $this->model
+            ->where($where)
+            ->where($dts)
+            ->order($sort, $order)
+            ->paginate($limit);
+        $result = ['total' => $list->total(), 'rows' => $list->items()];
+        return json($result);
+    }
+
+    /**
+     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
+     * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
+     * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+     */
+
+    /**
+     * 添加
+     *
+     * @return string
+     * @throws \think\Exception
+     */
+    public function add()
+    {
+        if (false === $this->request->isPost()) {
+            return $this->view->fetch();
+        }
+        $params = $this->request->post('row/a');
+        if (empty($params)) {
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        $ra_id=session('despid');
+        $params['pid']=$ra_id;
+        $params = $this->preExcludeFields($params);
+
+        if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
+            $params[$this->dataLimitField] = $this->auth->id;
+        }
+        $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()->validate($validate);
+            }
+            $result = $this->model->allowField(true)->save($params);
+            Db::commit();
+        } catch (ValidateException|PDOException|Exception $e) {
+            Db::rollback();
+            $this->error($e->getMessage());
+        }
+        if ($result === false) {
+            $this->error(__('No rows were inserted'));
+        }
+        $this->success();
+    }
+
+}

+ 37 - 0
application/admin/controller/sms/Log.php

@@ -0,0 +1,37 @@
+<?php
+
+namespace app\admin\controller\sms;
+
+use app\common\controller\Backend;
+
+/**
+ * 
+ *
+ * @icon fa fa-circle-o
+ */
+class Log extends Backend
+{
+
+    /**
+     * Log模型对象
+     * @var \app\admin\model\sms\Log
+     */
+    protected $model = null;
+
+    public function _initialize()
+    {
+        parent::_initialize();
+        $this->model = new \app\admin\model\sms\Log;
+        $this->view->assign("statusList", $this->model->getStatusList());
+    }
+
+
+
+    /**
+     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
+     * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
+     * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+     */
+
+
+}

+ 156 - 0
application/admin/controller/sms/Template.php

@@ -0,0 +1,156 @@
+<?php
+
+namespace app\admin\controller\sms;
+
+use app\admin\model\UserGroup;
+use app\common\controller\Backend;
+use think\Db;
+use think\exception\DbException;
+use think\exception\PDOException;
+use think\exception\ValidateException;
+
+/**
+ * 
+ *
+ * @icon fa fa-circle-o
+ */
+class Template extends Backend
+{
+
+    /**
+     * Template模型对象
+     * @var \app\admin\model\sms\Template
+     */
+    protected $model = null;
+
+    public function _initialize()
+    {
+        parent::_initialize();
+        $this->model = new \app\admin\model\sms\Template;
+        $this->view->assign("statusList", $this->model->getStatusList());
+    }
+    public function getType()
+    {
+        $list[0]['id']=0;
+        $list[0]['name']='分';
+        $list[1]['id']=1;
+        $list[1]['name']='时';
+        $list[2]['id']=2;
+        $list[2]['name']='天';
+
+
+        $i=$this->request->request('keyValue');
+        if ($i) {
+            return json(['list' => $list[$i], 'total' => count($list[$i])]);
+        }
+        return json(['list' => $list, 'total' => count($list)]);
+    }
+
+    /**
+     * 添加
+     *
+     * @return string
+     * @throws \think\Exception
+     */
+    public function add()
+    {
+        if (false === $this->request->isPost()) {
+            return $this->view->fetch();
+        }
+        $params = $this->request->post('row/a');
+        if($params['type']==2){
+            $params['sendtime']=$params['times']*24*60*60;
+        }elseif($params['type']==1){
+            $params['sendtime']=$params['times']*60*60;
+        }else{
+            $params['sendtime']=$params['times']*60;
+        }
+        if (empty($params)) {
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        $params = $this->preExcludeFields($params);
+        if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
+            $params[$this->dataLimitField] = $this->auth->id;
+        }
+        $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()->validate($validate);
+            }
+            $result = $this->model->allowField(true)->save($params);
+            Db::commit();
+        } catch (ValidateException|PDOException|Exception $e) {
+            Db::rollback();
+            $this->error($e->getMessage());
+        }
+        if ($result === false) {
+            $this->error(__('No rows were inserted'));
+        }
+        $this->success();
+    }
+    /**
+     * 编辑
+     *
+     * @param $ids
+     * @return string
+     * @throws DbException
+     * @throws \think\Exception
+     */
+    public function edit($ids = null)
+    {
+        $row = $this->model->get($ids);
+        if (!$row) {
+            $this->error(__('No Results were found'));
+        }
+        $adminIds = $this->getDataLimitAdminIds();
+        if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
+            $this->error(__('You have no permission'));
+        }
+        if (false === $this->request->isPost()) {
+            $this->view->assign('row', $row);
+            return $this->view->fetch();
+        }
+        $params = $this->request->post('row/a');
+        if (empty($params)) {
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        if($params['type']==2){
+            $params['sendtime']=$params['times']*24*60*60;
+        }elseif($params['type']==1){
+            $params['sendtime']=$params['times']*60*60;
+        }else{
+            $params['sendtime']=$params['times']*60;
+        }
+        $params = $this->preExcludeFields($params);
+        $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 . '.edit' : $name) : $this->modelValidate;
+                $row->validateFailException()->validate($validate);
+            }
+            $result = $row->allowField(true)->save($params);
+            Db::commit();
+        } catch (ValidateException|PDOException|Exception $e) {
+            Db::rollback();
+            $this->error($e->getMessage());
+        }
+        if (false === $result) {
+            $this->error(__('No rows were updated'));
+        }
+        $this->success();
+    }
+    /**
+     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
+     * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
+     * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+     */
+
+
+}

+ 6 - 0
application/admin/lang/zh-cn/appindex.php

@@ -0,0 +1,6 @@
+<?php
+
+return [
+    'Image'  => '图片',
+    'Status' => '状态'
+];

+ 5 - 0
application/admin/lang/zh-cn/appindexdes.php

@@ -0,0 +1,5 @@
+<?php
+
+return [
+    'Image' => '图片'
+];

+ 5 - 0
application/admin/lang/zh-cn/sms/log.php

@@ -0,0 +1,5 @@
+<?php
+
+return [
+
+];

+ 5 - 0
application/admin/lang/zh-cn/sms/template.php

@@ -0,0 +1,5 @@
+<?php
+
+return [
+
+];

+ 60 - 0
application/admin/model/Appindex.php

@@ -0,0 +1,60 @@
+<?php
+
+namespace app\admin\model;
+
+use think\Model;
+
+
+class Appindex extends Model
+{
+
+    
+
+    
+
+    // 表名
+    protected $name = 'appindex';
+    
+    // 自动写入时间戳字段
+    protected $autoWriteTimestamp = 'integer';
+
+    // 定义时间戳字段名
+    protected $createTime = 'addtime';
+    protected $updateTime = 'updatetime';
+    protected $deleteTime = false;
+
+    // 追加属性
+    protected $append = [
+        'status_text',
+        'addtime_text'
+    ];
+
+
+
+    public function getStatusList()
+    {
+        return ['1' => __('启用'), '2' => __('关闭')];
+    }
+
+
+    public function getStatusTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
+        $list = $this->getStatusList();
+        return isset($list[$value]) ? $list[$value] : '';
+    }
+
+
+    public function getAddtimeTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['addtime']) ? $data['addtime'] : '');
+        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
+    }
+
+    protected function setAddtimeAttr($value)
+    {
+        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
+    }
+
+
+}

+ 48 - 0
application/admin/model/Appindexdes.php

@@ -0,0 +1,48 @@
+<?php
+
+namespace app\admin\model;
+
+use think\Model;
+
+
+class Appindexdes extends Model
+{
+
+    
+
+    
+
+    // 表名
+    protected $name = 'appindexdes';
+    
+    // 自动写入时间戳字段
+    protected $autoWriteTimestamp = 'integer';
+
+    // 定义时间戳字段名
+    protected $createTime = 'addtime';
+    protected $updateTime = 'updatetime';
+    protected $deleteTime = false;
+
+    // 追加属性
+    protected $append = [
+        'addtime_text'
+    ];
+    
+
+    
+
+
+
+    public function getAddtimeTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['addtime']) ? $data['addtime'] : '');
+        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
+    }
+
+    protected function setAddtimeAttr($value)
+    {
+        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
+    }
+
+
+}

+ 49 - 0
application/admin/model/sms/Log.php

@@ -0,0 +1,49 @@
+<?php
+
+namespace app\admin\model\sms;
+
+use think\Model;
+
+
+class Log extends Model
+{
+
+    
+
+    
+
+    // 表名
+    protected $name = 'sms_log';
+    
+    // 自动写入时间戳字段
+    protected $autoWriteTimestamp = false;
+
+    // 定义时间戳字段名
+    protected $createTime = false;
+    protected $updateTime = false;
+    protected $deleteTime = false;
+
+    // 追加属性
+    protected $append = [
+        'status_text'
+    ];
+    
+
+    
+    public function getStatusList()
+    {
+        return ['1' => __('启用'),'2' => __('关闭')];
+    }
+
+
+    public function getStatusTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
+        $list = $this->getStatusList();
+        return isset($list[$value]) ? $list[$value] : '';
+    }
+
+
+
+
+}

+ 86 - 0
application/admin/model/sms/Template.php

@@ -0,0 +1,86 @@
+<?php
+
+namespace app\admin\model\sms;
+
+use think\Model;
+
+
+class Template extends Model
+{
+
+    
+
+    
+
+    // 表名
+    protected $name = 'sms_template';
+    
+    // 自动写入时间戳字段
+    protected $autoWriteTimestamp = false;
+
+    // 定义时间戳字段名
+    protected $createTime = false;
+    protected $updateTime = false;
+    protected $deleteTime = false;
+
+    // 追加属性
+    protected $append = [
+        'addtime_text',
+        'uptime_text',
+        'status_text',
+        'sendtime_text'
+    ];
+    
+
+    
+    public function getStatusList()
+    {
+        return ['1' => __('启用'),'2' => __('关闭')];
+    }
+
+
+    public function getAddtimeTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['addtime']) ? $data['addtime'] : '');
+        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
+    }
+
+
+    public function getUptimeTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['uptime']) ? $data['uptime'] : '');
+        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
+    }
+
+
+    public function getStatusTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
+        $list = $this->getStatusList();
+        return isset($list[$value]) ? $list[$value] : '';
+    }
+
+
+    public function getSendtimeTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['sendtime']) ? $data['sendtime'] : '');
+        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
+    }
+
+    protected function setAddtimeAttr($value)
+    {
+        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
+    }
+
+    protected function setUptimeAttr($value)
+    {
+        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
+    }
+
+    protected function setSendtimeAttr($value)
+    {
+        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
+    }
+
+
+}

+ 27 - 0
application/admin/validate/Appindex.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace app\admin\validate;
+
+use think\Validate;
+
+class Appindex extends Validate
+{
+    /**
+     * 验证规则
+     */
+    protected $rule = [
+    ];
+    /**
+     * 提示消息
+     */
+    protected $message = [
+    ];
+    /**
+     * 验证场景
+     */
+    protected $scene = [
+        'add'  => [],
+        'edit' => [],
+    ];
+    
+}

+ 27 - 0
application/admin/validate/Appindexdes.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace app\admin\validate;
+
+use think\Validate;
+
+class Appindexdes extends Validate
+{
+    /**
+     * 验证规则
+     */
+    protected $rule = [
+    ];
+    /**
+     * 提示消息
+     */
+    protected $message = [
+    ];
+    /**
+     * 验证场景
+     */
+    protected $scene = [
+        'add'  => [],
+        'edit' => [],
+    ];
+    
+}

+ 27 - 0
application/admin/validate/sms/Log.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace app\admin\validate\sms;
+
+use think\Validate;
+
+class Log extends Validate
+{
+    /**
+     * 验证规则
+     */
+    protected $rule = [
+    ];
+    /**
+     * 提示消息
+     */
+    protected $message = [
+    ];
+    /**
+     * 验证场景
+     */
+    protected $scene = [
+        'add'  => [],
+        'edit' => [],
+    ];
+    
+}

+ 27 - 0
application/admin/validate/sms/Template.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace app\admin\validate\sms;
+
+use think\Validate;
+
+class Template extends Validate
+{
+    /**
+     * 验证规则
+     */
+    protected $rule = [
+    ];
+    /**
+     * 提示消息
+     */
+    protected $message = [
+    ];
+    /**
+     * 验证场景
+     */
+    protected $scene = [
+        'add'  => [],
+        'edit' => [],
+    ];
+    
+}

+ 75 - 0
application/admin/view/appindex/add.html

@@ -0,0 +1,75 @@
+<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-title" class="form-control" name="row[title]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-name" class="form-control" name="row[name]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('模块type')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-showType" class="form-control" name="row[showType]" type="text">
+        </div>
+        <span class="extend" > 1: best seller  2:new in 3:图片check now   4:flash deal  5:图片 wholesale  6:shop by looking  7: membership</span>
+
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('跳转类型')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-type" class="form-control" name="row[type]" type="text">
+        </div>
+        <span class="extend" >0 web  1商品详情  2商品列表   3koc  4:注册页</span>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Desc')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-desc" class="form-control" name="row[desc]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Link')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-link" class="form-control" name="row[link]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <div class="input-group">
+                <input id="c-image" class="form-control" size="50" name="row[image]" type="text">
+                <div class="input-group-addon no-border no-padding">
+                    <span><button type="button" id="faupload-image" class="btn btn-danger faupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
+                    <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
+                </div>
+                <span class="msg-box n-right" for="c-image"></span>
+            </div>
+            <ul class="row list-inline faupload-preview" id="p-image"></ul>
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
+        <div class="col-xs-12 col-sm-8">
+
+            <div class="radio">
+                {foreach name="statusList" item="vo"}
+                <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="1"}checked{/in} /> {$vo}</label>
+                {/foreach}
+            </div>
+
+        </div>
+    </div>
+    <div class="form-group layer-footer">
+        <label class="control-label col-xs-12 col-sm-2"></label>
+        <div class="col-xs-12 col-sm-8">
+            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 76 - 0
application/admin/view/appindex/edit.html

@@ -0,0 +1,76 @@
+<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-title" class="form-control" name="row[title]" type="text" value="{$row.title|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-name" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('模块type')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-showType" class="form-control" name="row[showType]" type="text"  value="{$row.showType|htmlentities}">
+        </div>
+        <span class="extend" > 1: best seller  2:new in 3:图片check now   4:flash deal  5:图片 wholesale  6:shop by looking  7: membership</span>
+
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('跳转类型')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-type" class="form-control" name="row[type]" type="text" value="{$row.type|htmlentities}">
+        </div>
+        <span class="extend" >0 web  1商品详情  2商品列表   3koc  4:注册页</span>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Desc')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-desc" class="form-control" name="row[desc]" type="text" value="{$row.desc|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Link')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-link" class="form-control" name="row[link]" type="text" value="{$row.link|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <div class="input-group">
+                <input id="c-image" class="form-control" size="50" name="row[image]" type="text" value="{$row.image|htmlentities}">
+                <div class="input-group-addon no-border no-padding">
+                    <span><button type="button" id="faupload-image" class="btn btn-danger faupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
+                    <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
+                </div>
+                <span class="msg-box n-right" for="c-image"></span>
+            </div>
+            <ul class="row list-inline faupload-preview" id="p-image"></ul>
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            
+            <div class="radio">
+            {foreach name="statusList" item="vo"}
+            <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label> 
+            {/foreach}
+            </div>
+
+        </div>
+    </div>
+
+    <div class="form-group layer-footer">
+        <label class="control-label col-xs-12 col-sm-2"></label>
+        <div class="col-xs-12 col-sm-8">
+            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 39 - 0
application/admin/view/appindex/index.html

@@ -0,0 +1,39 @@
+<div class="panel panel-default panel-intro">
+    
+    <div class="panel-heading">
+        {:build_heading(null,FALSE)}
+    </div>
+
+
+    <div class="panel-body">
+        <div id="myTabContent" class="tab-content">
+            <div class="tab-pane fade active in" id="one">
+                <div class="widget-body no-padding">
+                    <div id="toolbar" class="toolbar">
+                        <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
+                        <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('appindex/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
+                        <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('appindex/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
+                        <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('appindex/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
+                        
+
+                        <div class="dropdown btn-group {:$auth->check('appindex/multi')?'':'hide'}">
+                            <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
+                            <ul class="dropdown-menu text-left" role="menu">
+                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
+                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
+                            </ul>
+                        </div>
+
+                        
+                    </div>
+                    <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
+                           data-operate-edit="{:$auth->check('appindex/edit')}"
+                           data-operate-del="{:$auth->check('appindex/del')}"
+                           width="100%">
+                    </table>
+                </div>
+            </div>
+
+        </div>
+    </div>
+</div>

+ 67 - 0
application/admin/view/appindexdes/add.html

@@ -0,0 +1,67 @@
+<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-title" class="form-control" name="row[title]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Link')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-link" class="form-control" name="row[link]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">Code:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-code" class="form-control" name="row[code]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">Price:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-nowPrice" class="form-control" name="row[nowPrice]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <div class="input-group">
+                <input id="c-image" class="form-control" size="50" name="row[image]" type="text">
+                <div class="input-group-addon no-border no-padding">
+                    <span><button type="button" id="faupload-image" class="btn btn-danger faupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
+                    <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
+                </div>
+                <span class="msg-box n-right" for="c-image"></span>
+            </div>
+            <ul class="row list-inline faupload-preview" id="p-image"></ul>
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-type" class="form-control" name="row[type]" type="text">
+        </div>
+        <span class="extend" >0 web  1商品详情  2商品列表   3koc  4:注册页</span>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Description')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-description" class="form-control" name="row[description]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Sort_order')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-sort_order" class="form-control" name="row[sort_order]" type="text">
+        </div>
+    </div>
+    <div class="form-group layer-footer">
+        <label class="control-label col-xs-12 col-sm-2"></label>
+        <div class="col-xs-12 col-sm-8">
+            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 67 - 0
application/admin/view/appindexdes/edit.html

@@ -0,0 +1,67 @@
+<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-title" class="form-control" name="row[title]" type="text" value="{$row.title|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Link')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-link" class="form-control" name="row[link]" type="text" value="{$row.link|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">Code:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-code" class="form-control" name="row[code]" type="text" value="{$row.code|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">Price:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-nowPrice" class="form-control" name="row[nowPrice]" type="text" value="{$row.nowPrice|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <div class="input-group">
+                <input id="c-image" class="form-control" size="50" name="row[image]" type="text" value="{$row.image|htmlentities}">
+                <div class="input-group-addon no-border no-padding">
+                    <span><button type="button" id="faupload-image" class="btn btn-danger faupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
+                    <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
+                </div>
+                <span class="msg-box n-right" for="c-image"></span>
+            </div>
+            <ul class="row list-inline faupload-preview" id="p-image"></ul>
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-type" class="form-control" name="row[type]" type="text" value="{$row.type|htmlentities}">
+        </div>
+        <span class="extend" >0 web  1商品详情  2商品列表   3koc  4:注册页</span>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Description')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-description" class="form-control" name="row[description]" type="text" value="{$row.description|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Sort_order')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-sort_order" class="form-control" name="row[sort_order]" type="text" value="{$row.sort_order|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group layer-footer">
+        <label class="control-label col-xs-12 col-sm-2"></label>
+        <div class="col-xs-12 col-sm-8">
+            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 35 - 0
application/admin/view/appindexdes/index.html

@@ -0,0 +1,35 @@
+<div class="panel panel-default panel-intro">
+    {:build_heading()}
+
+    <div class="panel-body">
+        <div id="myTabContent" class="tab-content">
+            <div class="tab-pane fade active in" id="one">
+                <div class="widget-body no-padding">
+                    <div id="toolbar" class="toolbar">
+                        <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
+                        <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('appindexdes/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
+                        <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('appindexdes/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
+                        <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('appindexdes/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
+                        
+
+                        <div class="dropdown btn-group {:$auth->check('appindexdes/multi')?'':'hide'}">
+                            <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
+                            <ul class="dropdown-menu text-left" role="menu">
+                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
+                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
+                            </ul>
+                        </div>
+
+                        
+                    </div>
+                    <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
+                           data-operate-edit="{:$auth->check('appindexdes/edit')}"
+                           data-operate-del="{:$auth->check('appindexdes/del')}"
+                           width="100%">
+                    </table>
+                </div>
+            </div>
+
+        </div>
+    </div>
+</div>

+ 106 - 0
application/admin/view/sms/log/add.html

@@ -0,0 +1,106 @@
+<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Addtime')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-addtime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[addtime]" type="text" value="{:date('Y-m-d H:i:s')}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Uptime')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-uptime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[uptime]" type="text" value="{:date('Y-m-d H:i:s')}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            
+            <div class="radio">
+            {foreach name="statusList" item="vo"}
+            <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="10"}checked{/in} /> {$vo}</label> 
+            {/foreach}
+            </div>
+
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Quote_id')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-quote_id" data-rule="required" data-source="quote/index" class="form-control selectpage" name="row[quote_id]" type="text" value="">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Mobile')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-mobile" class="form-control" name="row[mobile]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Ymobile')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-ymobile" class="form-control" name="row[ymobile]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Template_id')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-template_id" data-rule="required" data-source="template/index" class="form-control selectpage" name="row[template_id]" type="text" value="">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Remarks')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-remarks" class="form-control" name="row[remarks]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Template_body')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <textarea id="c-template_body" class="form-control " rows="5" name="row[template_body]" cols="50"></textarea>
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Bizid')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-bizId" class="form-control" name="row[bizId]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Requestid')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-requestId" class="form-control" name="row[requestId]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Sign')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-sign" class="form-control" name="row[sign]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Querynums')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-querynums" data-rule="required" class="form-control" name="row[querynums]" type="number" value="0">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Sendnums')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-sendnums" data-rule="required" class="form-control" name="row[sendnums]" type="number" value="0">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Email')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-email" class="form-control" name="row[email]" type="text">
+        </div>
+    </div>
+    <div class="form-group layer-footer">
+        <label class="control-label col-xs-12 col-sm-2"></label>
+        <div class="col-xs-12 col-sm-8">
+            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 106 - 0
application/admin/view/sms/log/edit.html

@@ -0,0 +1,106 @@
+<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Addtime')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-addtime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[addtime]" type="text" value="{:$row.addtime?datetime($row.addtime):''}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Uptime')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-uptime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[uptime]" type="text" value="{:$row.uptime?datetime($row.uptime):''}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            
+            <div class="radio">
+            {foreach name="statusList" item="vo"}
+            <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label> 
+            {/foreach}
+            </div>
+
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Quote_id')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-quote_id" data-rule="required" data-source="quote/index" class="form-control selectpage" name="row[quote_id]" type="text" value="{$row.quote_id|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Mobile')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-mobile" class="form-control" name="row[mobile]" type="text" value="{$row.mobile|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Ymobile')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-ymobile" class="form-control" name="row[ymobile]" type="text" value="{$row.ymobile|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Template_id')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-template_id" data-rule="required" data-source="template/index" class="form-control selectpage" name="row[template_id]" type="text" value="{$row.template_id|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Remarks')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-remarks" class="form-control" name="row[remarks]" type="text" value="{$row.remarks|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Template_body')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <textarea id="c-template_body" class="form-control " rows="5" name="row[template_body]" cols="50">{$row.template_body|htmlentities}</textarea>
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Bizid')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-bizId" class="form-control" name="row[bizId]" type="text" value="{$row.bizId|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Requestid')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-requestId" class="form-control" name="row[requestId]" type="text" value="{$row.requestId|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Sign')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-sign" class="form-control" name="row[sign]" type="text" value="{$row.sign|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Querynums')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-querynums" data-rule="required" class="form-control" name="row[querynums]" type="number" value="{$row.querynums|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Sendnums')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-sendnums" data-rule="required" class="form-control" name="row[sendnums]" type="number" value="{$row.sendnums|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Email')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-email" class="form-control" name="row[email]" type="text" value="{$row.email|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group layer-footer">
+        <label class="control-label col-xs-12 col-sm-2"></label>
+        <div class="col-xs-12 col-sm-8">
+            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 34 - 0
application/admin/view/sms/log/index.html

@@ -0,0 +1,34 @@
+<div class="panel panel-default panel-intro">
+    
+    <div class="panel-heading">
+        {:build_heading(null,FALSE)}
+    </div>
+
+
+    <div class="panel-body">
+        <div id="myTabContent" class="tab-content">
+            <div class="tab-pane fade active in" id="one">
+                <div class="widget-body no-padding">
+                    <div id="toolbar" class="toolbar">
+                        <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
+                        <div class="dropdown btn-group {:$auth->check('sms/log/multi')?'':'hide'}">
+                            <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
+                            <ul class="dropdown-menu text-left" role="menu">
+                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
+                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
+                            </ul>
+                        </div>
+
+                        
+                    </div>
+                    <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
+                           data-operate-edit="{:$auth->check('sms/log/edit')}"
+                           data-operate-del="{:$auth->check('sms/log/del')}"
+                           width="100%">
+                    </table>
+                </div>
+            </div>
+
+        </div>
+    </div>
+</div>

+ 60 - 0
application/admin/view/sms/template/add.html

@@ -0,0 +1,60 @@
+<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+
+    <div class="form-group" hidden>
+        <label class="control-label col-xs-12 col-sm-2">{:__('Addtime')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-addtime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[addtime]" type="text" value="{:date('Y-m-d H:i:s')}">
+        </div>
+    </div>
+    <div class="form-group" hidden>
+        <label class="control-label col-xs-12 col-sm-2">{:__('Uptime')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-uptime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[uptime]" type="text" value="{:date('Y-m-d H:i:s')}">
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-name" class="form-control" data-rule="required" name="row[name]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-type" data-rule="required" data-source="sms/template/getType" class="form-control selectpage" name="row[type]" type="text" value="">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Times')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-times" class="form-control"  data-rule="required" name="row[times]" type="number">
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Template_body')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <textarea id="c-template_body" data-rule="required" class="form-control " rows="5" name="row[template_body]" cols="50"></textarea>
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
+        <div class="col-xs-12 col-sm-8">
+
+            <div class="radio">
+                {foreach name="statusList" item="vo"}
+                <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="1"}checked{/in} /> {$vo}</label>
+                {/foreach}
+            </div>
+
+        </div>
+    </div>
+    <div class="form-group layer-footer">
+        <label class="control-label col-xs-12 col-sm-2"></label>
+        <div class="col-xs-12 col-sm-8">
+            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 53 - 0
application/admin/view/sms/template/edit.html

@@ -0,0 +1,53 @@
+<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+
+    <div class="form-group" hidden>
+        <label class="control-label col-xs-12 col-sm-2">{:__('Uptime')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-uptime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[uptime]" type="text" value="{:$row.uptime?datetime($row.uptime):''}">
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-name" class="form-control" data-rule="required"  name="row[name]" type="text" value="{$row.name|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-type" data-rule="required" data-source="sms/template/getType" class="form-control selectpage" name="row[type]" type="text" value="{$row.type|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Times')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-times" class="form-control"  data-rule="required"  name="row[times]" type="number" value="{$row.times|htmlentities}">
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Template_body')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <textarea id="c-template_body" data-rule="required"  class="form-control " rows="5" name="row[template_body]" cols="50">{$row.template_body|htmlentities}</textarea>
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
+        <div class="col-xs-12 col-sm-8">
+
+            <div class="radio">
+                {foreach name="statusList" item="vo"}
+                <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label>
+                {/foreach}
+            </div>
+        </div>
+    </div>
+    <div class="form-group layer-footer">
+        <label class="control-label col-xs-12 col-sm-2"></label>
+        <div class="col-xs-12 col-sm-8">
+            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 45 - 0
application/admin/view/sms/template/index.html

@@ -0,0 +1,45 @@
+<div class="panel panel-default panel-intro">
+    
+    <div class="panel-heading">
+        {:build_heading(null,FALSE)}
+        <ul class="nav nav-tabs" data-field="status">
+            <li class="{:$Think.get.status === null ? 'active' : ''}"><a href="#t-all" data-value="" data-toggle="tab">{:__('All')}</a></li>
+            {foreach name="statusList" item="vo"}
+            <li class="{:$Think.get.status === (string)$key ? 'active' : ''}"><a href="#t-{$key}" data-value="{$key}" data-toggle="tab">{$vo}</a></li>
+            {/foreach}
+        </ul>
+    </div>
+
+
+    <div class="panel-body">
+        <div id="myTabContent" class="tab-content">
+            <div class="tab-pane fade active in" id="one">
+                <div class="widget-body no-padding">
+                    <div id="toolbar" class="toolbar">
+                        <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
+                        <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('sms/template/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
+                        <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('sms/template/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
+                        <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('sms/template/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
+                        
+
+                        <div class="dropdown btn-group {:$auth->check('sms/template/multi')?'':'hide'}">
+                            <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
+                            <ul class="dropdown-menu text-left" role="menu">
+                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
+                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
+                            </ul>
+                        </div>
+
+                        
+                    </div>
+                    <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
+                           data-operate-edit="{:$auth->check('sms/template/edit')}"
+                           data-operate-del="{:$auth->check('sms/template/del')}"
+                           width="100%">
+                    </table>
+                </div>
+            </div>
+
+        </div>
+    </div>
+</div>

+ 116 - 0
application/api/common.php

@@ -1 +1,117 @@
 <?php
+
+use think\Db;
+
+function getCountryMobile($countryCode){
+
+    $where['country_id']=$countryCode;
+    $lists = Db::name('directory_country')->where($where)->find();
+
+    $countryMobile="9999";
+    if($lists){
+        $countryMobile =$lists['mobile_code'];
+    }
+    return (int)$countryMobile;
+}
+
+function checkMobile($countryMobile,$mobile,$countryCode)
+{
+    $mobile= str_replace('-', '', $mobile);
+    $mobile= str_replace('_', '', $mobile);
+    $mobile= str_replace('(', '', $mobile);
+    $mobile= str_replace(')', '', $mobile);
+    $mobile= str_replace('+', '', $mobile);
+    $mobile= str_replace(' ', '', $mobile);
+    $mobile=trim($mobile);
+    $lenth=strlen($mobile);
+    $data['status']=5;//不发送
+    $data['mobile']=$mobile;//不发送
+    $frist =(int)substr($mobile, 0, 1 );
+    if($countryMobile==1){//美国 加拿大
+        $code=0;
+        if($lenth==11&&$frist==1){//例:14696305087
+            $data['mobile'] = $mobile;
+            $code = substr($mobile , 1 , 3);
+            //$data['status']=1;//待发送
+        }
+        if($lenth==10&&$frist!=1){
+            $data['mobile'] = $countryMobile.$mobile;
+            $code = substr($mobile , 0 , 3);
+            //$data['status']=1;//待发送
+        }
+        if($code){
+            $re=checkMobileCode($code);
+            if($re){
+                $data['status']=1;//待发送
+            }
+        }
+        $data['sign']='13013071800';//签名
+    }
+
+    /*if($countryMobile==44){//UK
+        if($lenth==10&&$frist==7){
+            $data['mobile'] = $countryMobile.$mobile;
+            $data['status']=1;//待发送
+        }
+
+        if($lenth==11&&$frist==0){
+            $mobile =substr($mobile,1);
+            $frists =(int)substr($mobile, 0, 1 );
+            if($frists==7){
+                $data['mobile'] = $countryMobile.$mobile;
+                $data['status']=1;//待发送
+            }
+        }
+        if($lenth==12&&$frist==4){
+            $mobile=substr($mobile,2);
+            $frists =(int)substr($mobile, 0, 1 );
+            if($frists==7){
+                $data['mobile'] = $countryMobile.$mobile;
+                $data['status']=1;//待发送
+            }
+        }
+    }
+
+    if($countryMobile==33){//France
+        if($lenth==9){
+            if($frist==7||$frist==6){
+                $data['mobile'] = $countryMobile.$mobile;
+                $data['status']=1;//待发送
+            }
+
+        }
+
+        if($lenth==10&&$frist==0){
+            $mobile =substr($mobile,1);
+            $frists =(int)substr($mobile, 0, 1 );
+            if($frists==7||$frists==6){
+                $data['mobile'] = $countryMobile.$mobile;
+                $data['status']=1;//待发送
+            }
+        }
+        if($lenth==11&&$frist==3){
+            $mobile=substr($mobile,0,2);
+            $frists =(int)substr($mobile, 0, 1 );
+            if($frists==7||$frists==6){
+                $data['mobile'] = $countryMobile.$mobile;
+                $data['status']=1;//待发送
+            }
+        }
+    }*/
+
+    return $data;
+}
+
+function  checkMobileCode($code){
+    $lists = Db::name('directory_country_code')->select();
+    $token=[];
+    foreach ($lists as $v){
+        $token[]=$v['code'];
+    }
+    if (in_array($code, $token)) {
+        return true;
+    }else{
+        return false;
+    }
+
+}

+ 162 - 0
application/api/controller/Appindex.php

@@ -0,0 +1,162 @@
+<?php
+
+namespace app\api\controller;
+
+use app\common\controller\Api;
+use think\Db;
+
+/**
+ * 首页接口
+ */
+class Appindex extends Api
+{
+    protected $noNeedLogin = ['*'];
+    protected $noNeedRight = ['*'];
+
+    /**
+     * 首页
+     *
+     */
+    public function getIndexOne()
+    {
+       /* $topUrl =$this->getTopUrl();
+        $data['topUrl']=$topUrl;*/
+        $banner =$this->getBanner('轮播图');
+        $data['banner']=$banner;
+        $category =$this->getBanner('分类');
+        $data['category']=$category;
+        $this->success('',$data);
+    }
+
+    public function getIndexTwo()
+    {
+        $data =$this->getBlockShow();
+        $this->success('',$data);
+    }
+
+    public function getBlockShow()
+    {
+        $where['status']=1;
+        $where['showType']=array('egt',1);
+        $wheres['showType']=array('elt',7);
+        $data=Db::name('appindex')->where($where)->where($wheres)->select();
+        $new =array();
+        foreach ($data as $k=> $v){
+            $new[$k]=$this->doHandle($v);
+        }
+        return $new;
+    }
+
+    public function doHandle($v)
+    {
+        $data=array();
+        $data['title'] = $v['name'];
+        $data['showType'] = $v['showType'];// 1: best seller  2:new in 3:图片check now   4:flash deal  5:图片 wholesale  6:shop by looking  7: membership
+        $data['imgUrl'] ='';
+        $url=input('server.REQUEST_SCHEME') . '://' . input('server.SERVER_NAME');
+        if($v['image']){
+            $data['imgUrl'] =$url.$v['image'];
+        }
+        $data['type'] = $v['type'];
+        $data['typeId'] = $v['link'];
+        $data['titleArr'] = array();
+        if($data['showType'] ==6){
+            $ndata =array();
+            foreach ($this->getDetail($v['id']) as $k=> $vs){
+                $ndata[$k]['type'] = $vs['type'];
+                $ndata[$k]['title'] = $vs['title'];
+                $ndata[$k]['imgUrl'] = $url.$vs['image'];
+                $ndata[$k]['typeId'] = $vs['link'];
+            }
+            $data['titleArr'] =$ndata;
+        }
+        $data['productList'] = array();
+        if($data['showType'] ==1||$data['showType'] ==2||$data['showType'] ==4){
+            $ndatas =array();
+            $currencyCode='USD';
+            $currency_code =$this->request->header("Content-Currency");
+            if($currency_code){
+                $currencyCode =$currency_code;
+            }
+            $priceData = $this->getPrice($currencyCode);
+            foreach ($this->getDetail($v['id']) as $ks=> $vul){
+                $ndatas[$ks]['entity_id'] = $vul['link'];
+                $ndatas[$ks]['name'] = $vul['title'];
+                $ndatas[$ks]['image'] = $vul['images'];
+                if($vul['image']){
+                    $ndatas[$ks]['image'] =$url.$vul['image'];
+                }
+                $ndatas[$ks]['price'] = round($vul['oldPrice']*$priceData[0],2);
+                $ndatas[$ks]['final_price'] = round($vul['nowPrice']*$priceData[0],2);
+                if($ndatas[$ks]['price']){
+                    $percent = 100-round($vul['nowPrice']/$vul['oldPrice'],2)*100;
+                    $ndatas[$ks]['percent']= $percent;
+                    $ndatas[$ks]['discount_app']=$percent.'% Off';
+                }
+
+                $ndatas[$ks]['currencySymbol']=$priceData[1];
+                //$ndatas[$ks]['sale_num'] = $vul['sale_num'];
+                //$ndatas[$ks]['currencySymbol']=$currencySymbol;
+            }
+            $data['productList'] =$ndatas;
+        }
+        return $data;
+    }
+
+    public function getPrice($currencyCode)
+    {
+        $data['AUD']=[1.5,'A$'];
+        $data['GBP']=[0.88,'£'];
+        $data['CAD']=[1.33,'CA$'];
+        $data['EUR']=[1.0022,'€'];
+        $data['ZAR']=[17.8,'ZAR'];
+        $data['USD']=[1,'$'];
+        if(empty($data[$currencyCode])){
+            $currencyCode='USD';
+        }
+        return $data[$currencyCode];
+    }
+
+    public function getBanner($code)
+    {
+        $banner=$this->getBlockDetail($code);
+        $new=array();
+        $url=input('server.REQUEST_SCHEME') . '://' . input('server.SERVER_NAME');
+        foreach ($banner as $k=> $v){
+            $new[$k]['title'] = $v['title'];
+            $new[$k]['link'] = $v['link'];
+            $new[$k]['type'] = $v['type'];
+            $new[$k]['image'] =$url.$v['image'];
+        }
+        return $new;
+    }
+    public function getTopUrl($code)
+    {
+        $block =$this->getBlock($code);
+        $new['title'] = $block['title'];
+        $new['name'] = $block['name'];
+        $new['link'] = $block['link'];
+        $new['type'] = $block['type'];
+        return $new;
+    }
+    public function getBlock($code)
+    {
+        $where['status']=1;
+        $where['title']=$code;
+        return Db::name('appindex')->where($where)->find();
+    }
+    public function getDetail($id)
+    {
+        $where['pid']=$id;
+        return Db::name('appindexdes')->where($where)->select();
+    }
+    public function getBlockDetail($code)
+    {
+        $where['status']=1;
+        $where['title']=$code;
+        $block= Db::name('appindex')->where($where)->find();
+        unset($where);
+        $where['pid']=$block['id'];
+        return Db::name('appindexdes')->where($where)->select();
+    }
+}

+ 139 - 0
application/api/controller/Assms.php

@@ -0,0 +1,139 @@
+<?php
+
+namespace app\api\controller;
+
+use app\common\controller\Api;
+use app\common\library\Sms as Smslib;
+use app\common\model\User;
+use think\Db;
+use think\Exception;
+use think\exception\PDOException;
+use think\helper\hash\Md5;
+use think\Hook;
+use think\Queue;
+/**
+ * 手机短信接口
+ */
+class Assms extends Api
+{
+    protected $noNeedLogin = '*';
+    protected $noNeedRight = '*';
+
+    public function addSmsLog(){
+        $post=$this->request->post();
+        $sign =$post['sign'];
+        if($sign!=Md5('longyi_as')){
+            $this->error('sign error');
+        }
+        $this->addSmsQuote($post);
+        $this->success(__('success'));
+    }
+
+    public function cancelSmsLog(){
+        $post=$this->request->post();
+        $sign =$post['sign'];
+        if($sign!=Md5('longyi_as')){
+            $this->error('sign error');
+        }
+        $quote_id= $post['quote_id'];
+        $mobile =$post['mobile'];
+        $where['quote_id']=$quote_id;
+        $where['ymobile']=$mobile;
+        $where['status']=1;
+        Db::name('sms_log')->where($where)->delete();
+        $this->success(__('success'));
+    }
+
+    public function addSmsQuote($quote)
+    {
+        $quote_id= $quote['quote_id'];
+        $name = $quote['name'];
+        $mobile =$quote['mobile'];
+        $email =$quote['email'];
+        $countryCode = $quote['countryCode'];
+        $countryMobile =911;
+        if(!$mobile){
+            return ;
+        }
+        if($countryCode){
+            $countryMobile = getCountryMobile($countryCode);
+        }
+        if($mobile){
+            $datas =checkMobile($countryMobile,$mobile,$countryCode);
+            $mobiles=$datas['mobile'];
+            //删除手机号、购物车ID相同待发送短信信息
+            $where['mobile']=$mobiles;
+
+            Db::name('sms_log')->where($where)->where('status=1 or status=5')->delete();
+            unset($where);
+            $where['status']=1;
+            $template= Db::name('sms_template')->where($where)->select();
+            $data=array();
+            //循环添加发送短信
+            foreach ($template as $k=> $v){
+                $template_id = $v['template_id'];
+                $data[$k]['email'] =$email;
+                $data[$k]['ymobile'] =$mobile;
+                $data[$k]['quote_id']=$quote_id;
+                $data[$k]['template_id']=$template_id;
+                $data[$k]['status']=$datas['status'];
+                $data[$k]['mobile']=$datas['mobile'];
+                $data[$k]['addtime']=time();
+                $data[$k]['uptime']=time();
+                $data[$k]['sendtime']=time()+$v['sendtime'];
+                $data[$k]['remarks']=$countryMobile;
+                $data[$k]['template_body']= $this->getMssage($v['template_body'],$name);
+                $data[$k]['template_name']= $v['name'];
+            }
+            try {
+                Db::name('sms_log')->insertAll($data);
+            }catch (\PDOException $e){
+                $e->getMessage();
+
+            } catch (\Exception $e) {
+                var_dump($e->getMessage());
+            }
+
+        }
+
+    }
+    public function  getMssage($template_body,$name){
+        $search = '{#NAME}';
+        $message=str_replace($search,$name,$template_body);
+        return $message;
+    }
+
+
+    public function  addLogQueue(){
+        $model = new \app\admin\model\sms\Log;
+        $where['sendtime']=array('lt',time());
+        $where['status']=1;
+        $one_push = Db::name('sms_log')->where($where)->order('log_id')->limit(10)->select();
+        if (empty($one_push)) {
+            echo '没有查到待发送短信';
+            exit;
+        }
+        // 1.当前任务将由哪个类来负责处理。
+        //   当轮到该任务时,系统将生成一个该类的实例,并调用其 fire 方法
+        $jobHandlerClassName  ='app\job\Sendsms';
+        // 2.当前任务归属的队列名称,如果为新队列,会自动创建
+        $jobQueueName     = "createSmsJob";
+        $new=array();
+        foreach ($one_push as $k=>$v){
+            $new[$k]['log_id']=$v['log_id'];
+            $new[$k]['status']=2;
+            $jobData['log_id']=$v['log_id'];
+            $jobData['mobile']=$v['mobile'];
+            $jobData['template_body']=$v['template_body'];
+            $isPushed = Queue::push($jobHandlerClassName , $jobData , $jobQueueName);
+            // database 驱动时,返回值为 1|false  ;   redis 驱动时,返回值为 随机字符串|false
+            if ($isPushed !== false) {
+                echo $v['mobile']." 队列加入成功";
+            } else {
+                file_get_contents('test.txt',$v['mobile'],FILE_APPEND);
+                echo "队列加入失败";
+            }
+        }
+        $model->saveAll($new);
+    }
+}

+ 52 - 0
application/common/model/Assms.php

@@ -0,0 +1,52 @@
+<?php
+
+namespace app\common\model;
+
+use think\Model;
+use think\Config;
+class Assms Extends Model
+{
+
+    public function sendSms($data){
+        $result = $this->sendSmsClick($data['mobile'],$data['template_body']);
+        return $result;
+    }
+    function sendSmsClick($phone,$template_body)
+    {
+        $accessKeyId =Config::get('site.clickappid');
+        $accessKeySecret =  Config::get('site.clickAppSecret');
+        // Configure HTTP basic authorization: BasicAuth
+        $config = \ClickSend\Configuration::getDefaultConfiguration()
+            ->setUsername($accessKeyId)
+            ->setPassword($accessKeySecret);
+
+        $apiInstance = new \ClickSend\Api\SMSApi(new \GuzzleHttp\Client(),$config);
+        $msg = new \ClickSend\Model\SmsMessage();
+        $msg->setBody($template_body);
+        $msg->setTo($phone);
+        $msg->setSource("sdk");
+
+        $sms_messages = new \ClickSend\Model\SmsMessageCollection();
+        $sms_messages->setMessages([$msg]);
+        // print_r(json_decode($var,true));
+        $result=false;
+        try {
+            $result = $apiInstance->smsSendPost($sms_messages);
+
+            $result=json_decode($result,true);
+
+            if($result['http_code']==200){
+                $result=$result['data']['messages'][0];
+                if($result['status']!='SUCCESS'){
+                    $result=false;
+                }
+            }else{
+                $result=false;
+            }
+        } catch (Exception $e) {
+            echo 'Exception when calling SMSApi->smsSendPost: ', $e->getMessage(), PHP_EOL;
+        }
+        return $result;
+    }
+
+}

+ 36 - 0
application/common/model/Coupon.php

@@ -33,4 +33,40 @@ class Coupon Extends Model
         return $result; // 返回数据
     }
 
+    public function getProduct($pid){
+        $url ='https://www.bilisar.com/rest/V1/rewrite/categories/'.$pid.'/products';
+        $getFields = array(
+            'currencyCode' => 'USB',
+            'page' => 1,
+            'size' => 4,
+            'order' => 'position',
+            'dir' => 'DESC',
+        );
+        $queryString = http_build_query($getFields); // 将参数转换为查询字符串
+        $url = $url . '?' . $queryString; // 构建完整的URL
+        $re = $this->httpGet($url);
+        return json_decode($re,true);
+    }
+
+
+    public static function httpGet($url)
+    {
+        // 初始化cURL会话
+        $ch = curl_init();
+// 设置cURL选项
+        curl_setopt($ch, CURLOPT_URL, $url); // 你要访问的URL
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // 将curl_exec()获取的信息以字符串返回,而不是直接输出
+        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);//curl 取消 ssl 检查
+// 执行cURL会话
+        $response = curl_exec($ch);
+// 检查是否有错误发生
+        if(curl_errno($ch)){
+            echo 'cURL error: ' . curl_error($ch);
+        }
+// 关闭cURL会话
+        curl_close($ch);
+// 打印响应内容
+        return $response;
+    }
+
 }

+ 31 - 0
application/job/Sendsms.php

@@ -0,0 +1,31 @@
+<?php
+/***
+ * User: jun_hy
+ * Date: 2022/7/14
+ * Time: 10:48
+ */
+
+namespace app\job;
+use think\queue\Job;
+use app\common\model\Assms;
+use think\Db;
+class Sendsms
+{
+    public function fire(Job $job, $data)
+    {
+        $job->delete(); // 删除任务
+        $send =new Assms();
+        $result = $send->sendSms($data);
+        $new=array();
+        if ($result) {
+            $new['bizId']= $result['message_id'];
+            $new['requestId']='clicksend';
+            $new['status']=3;
+        }else{
+            $new['status']=4;
+        }
+        $new['uptime']=time();
+        $log_id['log_id'] =$data['log_id'];
+        Db::name('sms_log')->where($log_id)->update($new);
+    }
+}

+ 2 - 1
composer.json

@@ -29,7 +29,8 @@
         "ext-curl": "*",
         "ext-pdo": "*",
         "ext-bcmath": "*",
-        "onesignal/onesignal-php-api": "*@dev"
+        "onesignal/onesignal-php-api": "*@dev",
+        "clicksend/clicksend-php": "^5.0"
     },
     "config": {
         "preferred-install": "dist",

+ 67 - 0
public/assets/js/backend/appindex.js

@@ -0,0 +1,67 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
+
+    var Controller = {
+        index: function () {
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    index_url: 'appindex/index' + location.search,
+                    add_url: 'appindex/add',
+                    edit_url: 'appindex/edit',
+                    del_url: 'appindex/del',
+                    multi_url: 'appindex/multi',
+                    import_url: 'appindex/import',
+                    table: 'appindex',
+                }
+            });
+
+            var table = $("#table");
+
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                pk: 'id',
+                sortName: 'id',
+                columns: [
+                    [
+                        {checkbox: true},
+                        {field: 'id', title: __('Id')},
+                        {field: 'title', title: __('Title'), operate: 'LIKE'},
+                        {field: 'name', title: __('Name'), operate: 'LIKE'},
+                        {field: 'desc', title: __('Desc'), operate: 'LIKE'},
+                        {field: 'link', title: __('Link'), operate: 'LIKE'},
+                        {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
+                        {field: 'status', title: __('Status'), searchList: {"1":__('启用'),"2":__('关闭')}, formatter: Table.api.formatter.status},
+                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
+                            buttons:[
+                                {
+                                    name: 'detail',
+                                    hidden:false,
+                                    title: '模块内容',
+                                    classname: 'btn btn-xs btn-success btn-dialog',
+                                    icon: 'fa fa-list',
+                                    url: 'appindexdes/index',
+                                },
+                            ], 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;
+});

+ 56 - 0
public/assets/js/backend/appindexdes.js

@@ -0,0 +1,56 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
+
+    var Controller = {
+        index: function () {
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    index_url: 'appindexdes/index' + location.search,
+                    add_url: 'appindexdes/add',
+                    edit_url: 'appindexdes/edit',
+                    del_url: 'appindexdes/del',
+                    multi_url: 'appindexdes/multi',
+                    import_url: 'appindexdes/import',
+                    table: 'appindexdes',
+                }
+            });
+
+            var table = $("#table");
+
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                pk: 'id',
+                sortName: 'id',
+                fixedColumns: true,
+                fixedRightNumber: 1,
+                columns: [
+                    [
+                        {checkbox: true},
+                        {field: 'id', title: __('Id')},
+                        {field: 'title', title: __('Title')},
+                        {field: 'link', title: __('Link'), operate: false},
+                        {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
+                        {field: 'description', title: __('Description'), operate: false},
+                        {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;
+});

+ 63 - 0
public/assets/js/backend/sms/log.js

@@ -0,0 +1,63 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
+
+    var Controller = {
+        index: function () {
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    index_url: 'sms/log/index' + location.search,
+                    add_url: 'sms/log/add',
+                    edit_url: 'sms/log/edit',
+                    del_url: 'sms/log/del',
+                    multi_url: 'sms/log/multi',
+                    import_url: 'sms/log/import',
+                    table: 'sms_log',
+                }
+            });
+
+            var table = $("#table");
+
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                pk: 'log_id',
+                sortName: 'log_id',
+                fixedColumns: true,
+                fixedRightNumber: 1,
+                columns: [
+                    [
+                        {checkbox: true},
+                        {field: 'log_id', title: __('Id')},
+                        {field: 'template_id', title: __('模版ID')},
+                        {field: 'template_name', title: __('模版名称')},
+                        {field: 'mobile', title: __('手机号'), operate: 'LIKE'},
+                        {field: 'ymobile', title: __('原手机号'), operate: 'LIKE'},
+                        {field: 'email', title: __('邮箱'), operate: 'LIKE'},
+                        {field: 'quote_id', title: __('购物车ID')},
+                        {field: 'addtime', title: __('添加时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+                        {field: 'sendtime', title: __('发送时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+                        {field: 'status', title: __('Status'), searchList: {"1":__('待发送'),"2":__('发送中'),"3":__('已发送'),"4":__('发送失败'),"5":__('不发送')}, formatter: Table.api.formatter.status},
+
+
+                      //  {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;
+});

+ 56 - 0
public/assets/js/backend/sms/template.js

@@ -0,0 +1,56 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
+
+    var Controller = {
+        index: function () {
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    index_url: 'sms/template/index' + location.search,
+                    add_url: 'sms/template/add',
+                    edit_url: 'sms/template/edit',
+                    del_url: 'sms/template/del',
+                    multi_url: 'sms/template/multi',
+                    import_url: 'sms/template/import',
+                    table: 'sms_template',
+                }
+            });
+
+            var table = $("#table");
+
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                pk: 'template_id',
+                sortName: 'template_id',
+                fixedColumns: true,
+                fixedRightNumber: 1,
+                columns: [
+                    [
+                        {checkbox: true},
+                        {field: 'template_id', title: __('Id')},
+                        {field: 'name', title: __('Name'), operate: 'LIKE'},
+                        {field: 'status', title: __('Status'), searchList: {"1":__('启用'),"2":__('关闭')}, formatter: Table.api.formatter.status},
+                        {field: 'addtime', title: __('添加时间'), operate: false, formatter: Table.api.formatter.datetime},
+                        {field: 'uptime', title: __('修改时间'), operate: false, 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();
+        },
+        edit: function () {
+            Controller.api.bindevent();
+        },
+        api: {
+            bindevent: function () {
+                Form.api.bindevent($("form[role=form]"));
+            }
+        }
+    };
+    return Controller;
+});