删除了不相关的其他项目文件
This commit is contained in:
parent
74a9624781
commit
7e5ab2e3f0
36
README.en.md
36
README.en.md
@ -1,36 +0,0 @@
|
||||
# yii-dacms
|
||||
|
||||
#### Description
|
||||
基于YII2-advanced框架进行开发的数据内容管理系统
|
||||
|
||||
#### Software Architecture
|
||||
Software architecture description
|
||||
|
||||
#### Installation
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### Instructions
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### Contribution
|
||||
|
||||
1. Fork the repository
|
||||
2. Create Feat_xxx branch
|
||||
3. Commit your code
|
||||
4. Create Pull Request
|
||||
|
||||
|
||||
#### Gitee Feature
|
||||
|
||||
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
|
||||
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
|
||||
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
|
||||
4. The most valuable open source project [GVP](https://gitee.com/gvp)
|
||||
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
|
||||
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
34
README.md
34
README.md
@ -1,37 +1,21 @@
|
||||
# yii-dacms
|
||||
# ctms汽车托运物流管理系统
|
||||
|
||||
#### 介绍
|
||||
基于YII2-advanced框架进行开发的数据内容管理系统
|
||||
|
||||
基于YII2-advanced框架进行开发数据内容管理系统,包含业务运单、客户资源、 网点门店、财务、板车、合同、保单等管理板块。通过调用后端接口,实现管理后
|
||||
台网页版、桌面应用版、APP/轻应用版等。
|
||||
|
||||
#### 软件架构
|
||||
软件架构说明
|
||||
|
||||
|
||||
#### 安装教程
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
开发及建议运行环境:
|
||||
--PHP版本:7.x或8.0;
|
||||
--数据库:mysql 5.6;
|
||||
|
||||
#### 使用说明
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
1. 等待完善中……
|
||||
|
||||
#### 参与贡献
|
||||
|
||||
1. Fork 本仓库
|
||||
2. 新建 Feat_xxx 分支
|
||||
3. 提交代码
|
||||
4. 新建 Pull Request
|
||||
1. 方孟(fm453)
|
||||
|
||||
|
||||
#### 特技
|
||||
|
||||
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
|
||||
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
|
||||
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
|
||||
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
|
||||
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
|
||||
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
||||
|
@ -1 +0,0 @@
|
||||
将nativeapp公用的Model等文件集中出来,但为了类似项目借用该模式,避免与common文件夹搞混,故放于此处。
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-05-15T22:35:59+08:00
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-07-03T22:40:55+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
//以下设置用于解决跨域访问的CORS问题,顺便设置来路域名白名单
|
||||
const ORIGINARR = [
|
||||
'*' //开发中使用*,允许所有cors源。上线后注释掉
|
||||
];
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-05-15T21:33:17+08:00
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-06-29T16:38:03+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
$config = [
|
||||
'components' => [
|
||||
'db' => [
|
||||
'class' => 'yii\db\Connection',
|
||||
'dsn' => 'mysql:host=127.0.0.1;dbname=sass',
|
||||
'username' => 'sass',
|
||||
'password' => 'ejxsrxZCP34xNjF2',
|
||||
'charset' => 'utf8',
|
||||
'tablePrefix' => '',
|
||||
],
|
||||
'napp' => [
|
||||
'class' => 'yii\db\Connection',
|
||||
'dsn' => 'mysql:host=127.0.0.1;dbname=new_app',
|
||||
'username' => 'new_app',
|
||||
'password' => 'T4TASiwjkCFaYxP3',
|
||||
'charset' => 'utf8',
|
||||
'tablePrefix' => '',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
return $config;
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-05-16T20:41:55+08:00
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2022-05-16T20:41:58+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
$config = [
|
||||
'components' => [
|
||||
'db' => [
|
||||
'class' => 'yii\db\Connection',
|
||||
'dsn' => 'mysql:host=127.0.0.1;dbname=dacms',
|
||||
'username' => 'dacms',
|
||||
'password' => 'CiwE5YbLnL7Yw8zs',
|
||||
'charset' => 'utf8',
|
||||
'tablePrefix' => '',
|
||||
],
|
||||
'ac' => [
|
||||
'class' => 'yii\db\Connection',
|
||||
'dsn' => 'mysql:host=127.0.0.1;dbname=ctms',
|
||||
'username' => 'ctms',
|
||||
'password' => 'cP45w8z7RCtHstst',
|
||||
'charset' => 'utf8',
|
||||
'tablePrefix' => '',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
return $config;
|
@ -1,129 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客科技(www.hiluker.cn) <Fm453>
|
||||
# @Date: 1970-01-01T08:00:00+08:00
|
||||
# @Email: fm453@hiluker.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-06-29T16:40:55+08:00
|
||||
|
||||
return [
|
||||
'adminEmail' => 'fm453@lukegzs.com',
|
||||
'developerWx' => '18608981880',
|
||||
//默认值组
|
||||
'defaultAdminPassword' => 'Hi12345678', //默认的管理员密码
|
||||
'defaultAdminAvatar' => '@web/img/profile_small.png', //默认管理员头像
|
||||
'defaultUserPassword' => '12345678', //默认的用户密码
|
||||
'defaultUserAvatar' => '@web/img/profile_small.png', //默认管理员头像
|
||||
'defaultFansPassword' => '88888888', //默认的粉丝用户密码
|
||||
'defaultSuperRoleId' => 1, //默认的超级管理员角色id
|
||||
'defaultSuperAdminId' => 1, //默认的超级管理员id
|
||||
'siteOpenTime' => '8:00', //上班时间
|
||||
'siteCloseTime' => '20:00', //歇业时间
|
||||
'defaultAttributeValue' => '(未设置)', //空值默认
|
||||
'defaultActionColumnButtonOption' => ['class' => 'btn btn-white btn-xs'], //列表页操作按钮选项
|
||||
//阿里大鱼短信接口
|
||||
'aliDySms'=>[
|
||||
'accessKeyId'=>'LTAIQrJFtHfqsyOt',
|
||||
'accessKeySecret'=>'tvGieI3vNI7Si3imauCB4rJ3OX4AR8',
|
||||
'sign'=>'嗨路客',
|
||||
'reportQueueName'=>'Alicom-Queue-31737903-SmsReport', //状态报告接收
|
||||
'UpQueueName'=>'Alicom-Queue-31737903-SmsUp', //上行消息接收
|
||||
'tmpl'=>[
|
||||
'vcode'=>'SMS_116560526', //常规验证码
|
||||
'acBirthday'=>'SMS_175060008', //运车平台客户生日祝福
|
||||
'cwVcode'=>'SMS_175060662', //财务操作验证码
|
||||
'acGongxue'=>'SMS_152288813', //宫雪群发通知地址变更
|
||||
'shopOrderConfirmBuyer'=>'SMS_121905194', //商城订单确认通知下单人
|
||||
'shopOrderGm'=>'SMS_121910220', //商城订单知会管理员
|
||||
'shopOrderBuyer'=>'SMS_121850165', //商城订单知会下单人
|
||||
'meVcode'=>'SMS_116695056', //身份验证验证码
|
||||
'meChangeVcode'=>'SMS_116695050', //重要信息变更验证码
|
||||
'loginVcode'=>'SMS_116695054', //登陆确认验证码
|
||||
'addrNotice'=>'SMS_175050843', //托车地址知会
|
||||
]
|
||||
],
|
||||
'amap'=>[
|
||||
'key'=>'fea3f28a32780b33d97b2afb9a5236fe', //高德地图网页API-key
|
||||
],
|
||||
//平台ID
|
||||
'siteId'=>10, //每个站点ID对应一套数据集
|
||||
// 'app_id'=>1, //站点内允许存在多个应用
|
||||
// 'pid'=>1, //多个应用共用某个平台数据集时,约定平台ID
|
||||
'customerLevels' => [
|
||||
0 => '中',
|
||||
1 => '差',
|
||||
2 => '良',
|
||||
99 => '优',
|
||||
], //用户评级
|
||||
'attachSrc'=>'//'.$_SERVER['HTTP_HOST'], //附件远程地址
|
||||
'attachDir'=>'/upload-ctms', //附件远程目录
|
||||
'TruckStatus' => [
|
||||
0 => '待入库',
|
||||
1 => '正常',
|
||||
2 => '检修',
|
||||
3 => '保养',
|
||||
4 => '装车中',
|
||||
5 => '在途',
|
||||
99 => '锁定',
|
||||
], //板车状态
|
||||
'TruckOnlineStatus' => [
|
||||
0 => '待出发',
|
||||
1 => '进行中',
|
||||
99 => '已运达',
|
||||
], //板车任务状态
|
||||
'TruckCarsStatus' => [
|
||||
0 => '待承运',
|
||||
1 => '运输中',
|
||||
80 => '报障待处理',
|
||||
99 => '已运达',
|
||||
], //小车在承运板车上的状态
|
||||
'gender'=>['0'=>'未设置','1'=>'男','2'=>'女'], //性别
|
||||
'CommonStatus'=>['0'=>'隐藏','1'=>'显示'], //常规状态集
|
||||
'EmployeeStatus'=>['0'=>'离职','1'=>'在职'], //用户在职状态集
|
||||
'DriverStatus'=>['0'=>'离职','1'=>'在职','2'=>'外援'], //司机状态集
|
||||
'OrderStatus' => [
|
||||
-1 => '已取消',
|
||||
0 => '预备中',
|
||||
1 => '协议签定',
|
||||
2 => '运输中',
|
||||
3 => '已运达',
|
||||
4 => '已交车',
|
||||
5 => '待承运',
|
||||
6 => '待提车',
|
||||
7 => '待入库', //与提车关联
|
||||
99 => '完成',
|
||||
], //订单状态
|
||||
'AlbumStatus' => [
|
||||
-1 => '已隐藏',
|
||||
0 => '标准',
|
||||
99 => '完结',
|
||||
], //相册状态
|
||||
'DefaultCarInsuranceValueMax'=>20, //默认车辆保额;万元
|
||||
'DefaultCommissionMoreMax'=>100, //默认最多可多支付的佣金金额;元
|
||||
'Paytype'=>[
|
||||
0=>'现金',
|
||||
1=>'微信扫码',
|
||||
2=>'微信转账',
|
||||
3=>'支付宝扫码',
|
||||
4=>'支付宝转账',
|
||||
5=>'银行卡转账',
|
||||
6=>'对公转账',
|
||||
7=>'挂账月结',
|
||||
99=>'其他'
|
||||
], //支付方式
|
||||
'PayStatus'=>[
|
||||
0=>'待确认',
|
||||
1=>'已确认入账', //入账对关联金额数字有影响
|
||||
-1=>'财务已驳回',
|
||||
-2=>'确认冲红',
|
||||
2=>'申请冲红',
|
||||
99=>'仅确认不入账', //不入账则只做记录,不影响相关金额数字
|
||||
], //支付状态集
|
||||
'PayStatusRequireArr'=>[
|
||||
1=>[0,-1,99],
|
||||
-1=>[0,2],
|
||||
-2=>[2],
|
||||
99=>[0,-1],
|
||||
], //费用单支付状态在财审时的前置状态要求
|
||||
'H5Links'=>'//h5.ctms.localhost/',
|
||||
];
|
@ -1,129 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客科技(www.hiluker.cn) <Fm453>
|
||||
# @Date: 1970-01-01T08:00:00+08:00
|
||||
# @Email: fm453@hiluker.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2022-05-17T11:05:55+08:00
|
||||
|
||||
return [
|
||||
'adminEmail' => 'fm453@lukegzs.com',
|
||||
'developerWx' => '18608981880',
|
||||
//默认值组
|
||||
'defaultAdminPassword' => 'Hi12345678', //默认的管理员密码
|
||||
'defaultAdminAvatar' => '@web/img/profile_small.png', //默认管理员头像
|
||||
'defaultUserPassword' => '12345678', //默认的用户密码
|
||||
'defaultUserAvatar' => '@web/img/profile_small.png', //默认管理员头像
|
||||
'defaultFansPassword' => '88888888', //默认的粉丝用户密码
|
||||
'defaultSuperRoleId' => 1, //默认的超级管理员角色id
|
||||
'defaultSuperAdminId' => 1, //默认的超级管理员id
|
||||
'siteOpenTime' => '8:00', //上班时间
|
||||
'siteCloseTime' => '20:00', //歇业时间
|
||||
'defaultAttributeValue' => '(未设置)', //空值默认
|
||||
'defaultActionColumnButtonOption' => ['class' => 'btn btn-white btn-xs'], //列表页操作按钮选项
|
||||
//阿里大鱼短信接口
|
||||
'aliDySms'=>[
|
||||
'accessKeyId'=>'LTAIQrJFtHfqsyOt',
|
||||
'accessKeySecret'=>'tvGieI3vNI7Si3imauCB4rJ3OX4AR8',
|
||||
'sign'=>'嗨路客',
|
||||
'reportQueueName'=>'Alicom-Queue-31737903-SmsReport', //状态报告接收
|
||||
'UpQueueName'=>'Alicom-Queue-31737903-SmsUp', //上行消息接收
|
||||
'tmpl'=>[
|
||||
'vcode'=>'SMS_116560526', //常规验证码
|
||||
'acBirthday'=>'SMS_175060008', //运车平台客户生日祝福
|
||||
'cwVcode'=>'SMS_175060662', //财务操作验证码
|
||||
'acGongxue'=>'SMS_152288813', //宫雪群发通知地址变更
|
||||
'shopOrderConfirmBuyer'=>'SMS_121905194', //商城订单确认通知下单人
|
||||
'shopOrderGm'=>'SMS_121910220', //商城订单知会管理员
|
||||
'shopOrderBuyer'=>'SMS_121850165', //商城订单知会下单人
|
||||
'meVcode'=>'SMS_116695056', //身份验证验证码
|
||||
'meChangeVcode'=>'SMS_116695050', //重要信息变更验证码
|
||||
'loginVcode'=>'SMS_116695054', //登陆确认验证码
|
||||
'addrNotice'=>'SMS_175050843', //托车地址知会
|
||||
]
|
||||
],
|
||||
'amap'=>[
|
||||
'key'=>'fea3f28a32780b33d97b2afb9a5236fe',
|
||||
],
|
||||
//平台ID
|
||||
'siteId'=>10, //每个站点ID对应一套数据集
|
||||
// 'app_id'=>1, //站点内允许存在多个应用
|
||||
// 'pid'=>1, //多个应用共用某个平台数据集时,约定平台ID
|
||||
'customerLevels' => [
|
||||
0 => '中',
|
||||
1 => '差',
|
||||
2 => '良',
|
||||
99 => '优',
|
||||
], //用户评级
|
||||
'attachSrc'=>'//'.$_SERVER['HTTP_HOST'], //附件远程地址
|
||||
'attachDir'=>'/upload-ctms', //附件远程目录
|
||||
'TruckStatus' => [
|
||||
0 => '待入库',
|
||||
1 => '正常',
|
||||
2 => '检修',
|
||||
3 => '保养',
|
||||
4 => '装车中',
|
||||
5 => '在途',
|
||||
99 => '锁定',
|
||||
], //板车状态
|
||||
'TruckOnlineStatus' => [
|
||||
0 => '待出发',
|
||||
1 => '进行中',
|
||||
99 => '已运达',
|
||||
], //板车任务状态
|
||||
'TruckCarsStatus' => [
|
||||
0 => '待承运',
|
||||
1 => '运输中',
|
||||
80 => '报障待处理',
|
||||
99 => '已运达',
|
||||
], //小车在承运板车上的状态
|
||||
'gender'=>['0'=>'未设置','1'=>'男','2'=>'女'], //性别
|
||||
'CommonStatus'=>['0'=>'隐藏','1'=>'显示'], //常规状态集
|
||||
'EmployeeStatus'=>['0'=>'离职','1'=>'在职'], //用户在职状态集
|
||||
'DriverStatus'=>['0'=>'离职','1'=>'在职','2'=>'外援'], //司机状态集
|
||||
'OrderStatus' => [
|
||||
-1 => '已取消',
|
||||
0 => '预备中',
|
||||
1 => '协议签定',
|
||||
2 => '运输中',
|
||||
3 => '已运达',
|
||||
4 => '已交车',
|
||||
5 => '待承运',
|
||||
6 => '待提车',
|
||||
7 => '待入库', //与提车关联
|
||||
99 => '完成',
|
||||
], //订单状态
|
||||
'AlbumStatus' => [
|
||||
-1 => '已隐藏',
|
||||
0 => '标准',
|
||||
99 => '完结',
|
||||
], //相册状态
|
||||
'DefaultCarInsuranceValueMax'=>20, //默认车辆保额;万元
|
||||
'DefaultCommissionMoreMax'=>100, //默认最多可多支付的佣金金额;元
|
||||
'Paytype'=>[
|
||||
0=>'现金',
|
||||
1=>'微信扫码',
|
||||
2=>'微信转账',
|
||||
3=>'支付宝扫码',
|
||||
4=>'支付宝转账',
|
||||
5=>'银行卡转账',
|
||||
6=>'对公转账',
|
||||
7=>'挂账月结',
|
||||
99=>'其他'
|
||||
], //支付方式
|
||||
'PayStatus'=>[
|
||||
0=>'待确认',
|
||||
1=>'已确认入账', //入账对关联金额数字有影响
|
||||
-1=>'财务已驳回',
|
||||
-2=>'确认冲红',
|
||||
2=>'申请冲红',
|
||||
99=>'仅确认不入账', //不入账则只做记录,不影响相关金额数字
|
||||
], //支付状态集
|
||||
'PayStatusRequireArr'=>[
|
||||
1=>[0,-1,99],
|
||||
-1=>[0,2],
|
||||
-2=>[2],
|
||||
99=>[0,-1],
|
||||
], //费用单支付状态在财审时的前置状态要求
|
||||
'H5Links'=>'//h5.ctms.hiluker.com/',
|
||||
];
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-05-15T22:35:59+08:00
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-07-03T22:41:01+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
Yii::setAlias('@addons', __DIR__);
|
@ -1 +0,0 @@
|
||||
*
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-05-09T18:12:47+08:00
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-07-03T22:37:18+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
namespace addons\models;
|
||||
|
||||
use Yii;
|
||||
use yii\db\ActiveRecord;
|
||||
|
||||
class Appconfig extends ActiveRecord
|
||||
{
|
||||
//指定数据库
|
||||
public static function getDb()
|
||||
{
|
||||
return Yii::$app->get('napp');
|
||||
}
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function tableName()
|
||||
{
|
||||
return '{{%appconfig}}';
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-05-09T18:13:20+08:00
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-07-03T22:37:29+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
namespace addons\models;
|
||||
|
||||
use Yii;
|
||||
use yii\db\ActiveRecord;
|
||||
|
||||
class Appversion extends ActiveRecord
|
||||
{
|
||||
//指定数据库
|
||||
public static function getDb()
|
||||
{
|
||||
return Yii::$app->get('napp');
|
||||
}
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function tableName()
|
||||
{
|
||||
return '{{%appversion}}';
|
||||
}
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-05-09T18:14:04+08:00
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-07-03T22:37:32+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
namespace addons\models;
|
||||
|
||||
use Yii;
|
||||
use yii\db\ActiveRecord;
|
||||
|
||||
class Banner extends ActiveRecord
|
||||
{
|
||||
//指定数据库
|
||||
public static function getDb()
|
||||
{
|
||||
return Yii::$app->get('napp');
|
||||
}
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function tableName()
|
||||
{
|
||||
return '{{%banner}}';
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @inheritdoc
|
||||
// */
|
||||
// public function rules()
|
||||
// {
|
||||
// return [];
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * @inheritdoc
|
||||
// */
|
||||
// public function attributeLabels()
|
||||
// {
|
||||
// return [];
|
||||
// }
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-05-09T18:14:41+08:00
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2022-05-09T18:14:41+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
namespace addons\models;
|
||||
|
||||
use Yii;
|
||||
use yii\db\ActiveRecord;
|
||||
|
||||
class Fenlei extends ActiveRecord
|
||||
{
|
||||
//指定数据库
|
||||
public static function getDb()
|
||||
{
|
||||
return Yii::$app->get('napp');
|
||||
}
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function tableName()
|
||||
{
|
||||
return '{{%fenlei}}';
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-05-09T18:15:23+08:00
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-07-03T22:37:37+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
namespace addons\models;
|
||||
|
||||
use Yii;
|
||||
use yii\db\ActiveRecord;
|
||||
|
||||
class Gonggao extends ActiveRecord
|
||||
{
|
||||
//指定数据库
|
||||
public static function getDb()
|
||||
{
|
||||
return Yii::$app->get('napp');
|
||||
}
|
||||
|
||||
public static function tableName()
|
||||
{
|
||||
return '{{%gonggao}}';
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-05-09T18:15:34+08:00
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-07-03T22:37:46+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
namespace addons\models;
|
||||
|
||||
use Yii;
|
||||
use yii\db\ActiveRecord;
|
||||
|
||||
class Guidepage extends ActiveRecord
|
||||
{
|
||||
//指定数据库
|
||||
public static function getDb()
|
||||
{
|
||||
return Yii::$app->get('napp');
|
||||
}
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function tableName()
|
||||
{
|
||||
return '{{%guidepage}}';
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-05-09T18:12:47+08:00
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-07-03T22:37:50+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
namespace addons\models;
|
||||
|
||||
use Yii;
|
||||
use yii\db\ActiveRecord;
|
||||
|
||||
class Launcher extends ActiveRecord
|
||||
{
|
||||
//指定数据库
|
||||
public static function getDb()
|
||||
{
|
||||
return Yii::$app->get('napp');
|
||||
}
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function tableName()
|
||||
{
|
||||
return '{{%launcher}}';
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-05-09T18:12:47+08:00
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-07-03T22:37:55+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
namespace addons\models;
|
||||
|
||||
use Yii;
|
||||
use yii\db\ActiveRecord;
|
||||
|
||||
class Lianxiwom extends ActiveRecord
|
||||
{
|
||||
//指定数据库
|
||||
public static function getDb()
|
||||
{
|
||||
return Yii::$app->get('napp');
|
||||
}
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function tableName()
|
||||
{
|
||||
return '{{%lianxiwom}}';
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-05-09T18:12:47+08:00
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-07-03T22:38:00+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
namespace addons\models;
|
||||
|
||||
use Yii;
|
||||
use yii\db\ActiveRecord;
|
||||
|
||||
class News extends ActiveRecord
|
||||
{
|
||||
//指定数据库
|
||||
public static function getDb()
|
||||
{
|
||||
return Yii::$app->get('napp');
|
||||
}
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function tableName()
|
||||
{
|
||||
return '{{%news}}';
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-05-09T18:12:47+08:00
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-07-03T22:38:20+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
namespace addons\models;
|
||||
|
||||
use Yii;
|
||||
use yii\db\ActiveRecord;
|
||||
|
||||
class Newsimg extends ActiveRecord
|
||||
{
|
||||
//指定数据库
|
||||
public static function getDb()
|
||||
{
|
||||
return Yii::$app->get('napp');
|
||||
}
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function tableName()
|
||||
{
|
||||
return '{{%newsimg}}';
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-05-09T18:12:47+08:00
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-07-03T22:38:36+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
namespace addons\models;
|
||||
|
||||
use Yii;
|
||||
use yii\db\ActiveRecord;
|
||||
|
||||
class Resou extends ActiveRecord
|
||||
{
|
||||
//指定数据库
|
||||
public static function getDb()
|
||||
{
|
||||
return Yii::$app->get('napp');
|
||||
}
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function tableName()
|
||||
{
|
||||
return '{{%resou}}';
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-05-09T18:12:47+08:00
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-07-03T22:38:53+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
namespace addons\models;
|
||||
|
||||
use Yii;
|
||||
use yii\db\ActiveRecord;
|
||||
|
||||
class Role extends ActiveRecord
|
||||
{
|
||||
//指定数据库
|
||||
public static function getDb()
|
||||
{
|
||||
return Yii::$app->get('napp');
|
||||
}
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function tableName()
|
||||
{
|
||||
return '{{%role}}';
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-05-09T18:12:47+08:00
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-07-03T22:39:10+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
namespace addons\models;
|
||||
|
||||
use Yii;
|
||||
use yii\db\ActiveRecord;
|
||||
|
||||
class Shoucang extends ActiveRecord
|
||||
{
|
||||
//指定数据库
|
||||
public static function getDb()
|
||||
{
|
||||
return Yii::$app->get('napp');
|
||||
}
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function tableName()
|
||||
{
|
||||
return '{{%shoucang}}';
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-05-09T18:12:47+08:00
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2022-05-09T18:13:08+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
namespace addons\models;
|
||||
|
||||
use Yii;
|
||||
use yii\db\ActiveRecord;
|
||||
|
||||
class AcAlbumPics extends ActiveRecord
|
||||
{
|
||||
//指定数据库
|
||||
public static function getDb()
|
||||
{
|
||||
return Yii::$app->get('ac');
|
||||
}
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function tableName()
|
||||
{
|
||||
return '{{%ac_album_pics}}';
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-05-09T18:12:47+08:00
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-07-03T22:39:44+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
namespace addons\models;
|
||||
|
||||
use Yii;
|
||||
use yii\db\ActiveRecord;
|
||||
|
||||
class UserRoles extends ActiveRecord
|
||||
{
|
||||
//指定数据库
|
||||
public static function getDb()
|
||||
{
|
||||
return Yii::$app->get('napp');
|
||||
}
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function tableName()
|
||||
{
|
||||
return '{{%user_roles}}';
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-05-09T18:12:47+08:00
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-07-03T22:40:24+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
namespace addons\models;
|
||||
|
||||
use Yii;
|
||||
use yii\db\ActiveRecord;
|
||||
|
||||
class Weihu extends ActiveRecord
|
||||
{
|
||||
//指定数据库
|
||||
public static function getDb()
|
||||
{
|
||||
return Yii::$app->get('napp');
|
||||
}
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function tableName()
|
||||
{
|
||||
return '{{%weihu}}';
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-05-09T18:12:47+08:00
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-07-03T22:40:46+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
namespace addons\models;
|
||||
|
||||
use Yii;
|
||||
use yii\db\ActiveRecord;
|
||||
|
||||
class Yijianfankui extends ActiveRecord
|
||||
{
|
||||
//指定数据库
|
||||
public static function getDb()
|
||||
{
|
||||
return Yii::$app->get('napp');
|
||||
}
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function tableName()
|
||||
{
|
||||
return '{{%yijianfankui}}';
|
||||
}
|
||||
}
|
@ -1,356 +0,0 @@
|
||||
/**
|
||||
* @Author: 嗨噜客(三亚) <fm453>
|
||||
* @Date: 2024-07-04T19:13:18+08:00
|
||||
* @Email: 393213759@qq.com
|
||||
* @Last modified by: fm453
|
||||
* @Last modified time: 2024-07-04T19:13:18+08:00
|
||||
* @Copyright: www.hiluker.cn
|
||||
*/
|
||||
|
||||
/*
|
||||
Navicat MySQL Data Transfer
|
||||
|
||||
Source Server : 本地
|
||||
Source Server Type : MySQL
|
||||
Source Server Version : 50724
|
||||
Source Host : localhost:3306
|
||||
Source Schema : news
|
||||
|
||||
Target Server Type : MySQL
|
||||
Target Server Version : 50724
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 19/08/2023 21:31:52
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for appconfig
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `appconfig`;
|
||||
CREATE TABLE `appconfig` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`isShowLauncher` tinyint(1) NOT NULL DEFAULT 1 COMMENT '启动页显示开关',
|
||||
`isShowGongGao` tinyint(1) NOT NULL DEFAULT 1 COMMENT '主页公告显示开关',
|
||||
`isShowBanner` tinyint(1) NOT NULL DEFAULT 1 COMMENT '轮播图显示开关',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = MyISAM AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = FIXED;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of appconfig
|
||||
-- ----------------------------
|
||||
INSERT INTO `appconfig` VALUES (1, 0, 0, 0);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for appversion
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `appversion`;
|
||||
CREATE TABLE `appversion` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`isqiangzhi` tinyint(1) NOT NULL DEFAULT 0 COMMENT '强制更新开关',
|
||||
`banbenhao` int(11) NOT NULL COMMENT '版本号',
|
||||
`banbenming` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '版本名',
|
||||
`lianjie` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '下载链接',
|
||||
`shuoming` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '有新版本,是否更新' COMMENT '更新说明',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = MyISAM AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of appversion
|
||||
-- ----------------------------
|
||||
INSERT INTO `appversion` VALUES (1, 0, 1, '测试', 'http://192.168.2.103:8888/static/test.apk', '请确保以上下载链接地址http://192.168.2.103:8888/static/test.apk的IP地址是自己电脑的局域网IP地址');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for banner
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `banner`;
|
||||
CREATE TABLE `banner` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`imgUrl` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '图片地址',
|
||||
`jumpUrl` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'http://www.baidu.com' COMMENT '点击跳转地址',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = MyISAM AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of banner
|
||||
-- ----------------------------
|
||||
INSERT INTO `banner` VALUES (1, '/static/test.bmp', 'http://www.baidu.com');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for comments
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `comments`;
|
||||
CREATE TABLE `comments` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`uid` bigint(20) NULL DEFAULT 0 COMMENT '用户ID',
|
||||
`touid` bigint(20) NULL DEFAULT 0 COMMENT '回复id',
|
||||
`newsid` bigint(20) NULL DEFAULT 0 COMMENT '新闻id',
|
||||
`commentid` bigint(20) NULL DEFAULT 0 COMMENT '评论id',
|
||||
`parentid` bigint(20) NULL DEFAULT 0 COMMENT '父评论id',
|
||||
`content` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '内容',
|
||||
`likes` int(11) NULL DEFAULT 0 COMMENT '点赞数',
|
||||
`addtime` bigint(20) UNSIGNED NULL DEFAULT 0 COMMENT '添加时间',
|
||||
`at_info` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '评论时被@用户的信息(json串)',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of comments
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for fenlei
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `fenlei`;
|
||||
CREATE TABLE `fenlei` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`fenlei` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '新闻分类',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of fenlei
|
||||
-- ----------------------------
|
||||
INSERT INTO `fenlei` VALUES (1, '资讯');
|
||||
INSERT INTO `fenlei` VALUES (2, '攻略');
|
||||
INSERT INTO `fenlei` VALUES (3, '公告');
|
||||
INSERT INTO `fenlei` VALUES (4, '其他');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for gonggao
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `gonggao`;
|
||||
CREATE TABLE `gonggao` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`content` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '公告内容',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = MyISAM AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of gonggao
|
||||
-- ----------------------------
|
||||
INSERT INTO `gonggao` VALUES (1, '您好,为了您的财物安全,请您务必做好防范,勿轻信低价拉单,注意避免私下交易...');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for guidepage
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `guidepage`;
|
||||
CREATE TABLE `guidepage` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`img` varchar(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COMMENT '图片地址',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = MyISAM AUTO_INCREMENT = 2 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of guidepage
|
||||
-- ----------------------------
|
||||
INSERT INTO `guidepage` VALUES (1, '/static/test.bmp');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for history
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `history`;
|
||||
CREATE TABLE `history` (
|
||||
`hid` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`newsid` bigint(20) NOT NULL COMMENT '新闻id',
|
||||
`uid` bigint(20) NOT NULL COMMENT '用户ID',
|
||||
PRIMARY KEY (`hid`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for launcher
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `launcher`;
|
||||
CREATE TABLE `launcher` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`img` varchar(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COMMENT '图片地址',
|
||||
`showTime` int(11) NOT NULL DEFAULT 3 COMMENT '展示时间',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = MyISAM AUTO_INCREMENT = 2 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of launcher
|
||||
-- ----------------------------
|
||||
INSERT INTO `launcher` VALUES (1, '/static/test.bmp', 3);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for lianxiwom
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `lianxiwom`;
|
||||
CREATE TABLE `lianxiwom` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`content` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '联系我们内容如客服电话:xxxx',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of lianxiwom
|
||||
-- ----------------------------
|
||||
INSERT INTO `lianxiwom` VALUES (1, '客服电话:132-1111-1058');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for news
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `news`;
|
||||
CREATE TABLE `news` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`mingcheng` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '新闻标题',
|
||||
`leixing` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '新闻类型',
|
||||
`liulanliang` bigint(20) NOT NULL DEFAULT 0 COMMENT '新闻浏览量销量',
|
||||
`xiangqinghtml` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '新闻详情',
|
||||
`isshangjia` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0上架1下架',
|
||||
`time` bigint(20) UNSIGNED NULL DEFAULT 0 COMMENT '发布日期',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT =1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of news
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for newsimg
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `newsimg`;
|
||||
CREATE TABLE `newsimg` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`newsid` bigint(20) NOT NULL COMMENT '新闻id',
|
||||
`img` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '新闻图片',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of newsimg
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for resou
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `resou`;
|
||||
CREATE TABLE `resou` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`content` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '热搜关键词',
|
||||
`addtime` bigint(20) UNSIGNED NULL DEFAULT 0 COMMENT '添加时间',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of resou
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for role
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `role`;
|
||||
CREATE TABLE `role` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '名字',
|
||||
`desc` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '描述',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE INDEX `name`(`name`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of role
|
||||
-- ----------------------------
|
||||
INSERT INTO `role` VALUES (1, 'ROLE_ADMIN', '超级管理员');
|
||||
INSERT INTO `role` VALUES (2, 'ROLE_USER', '普通用户');
|
||||
INSERT INTO `role` VALUES (3, 'ROLE_VIP', 'vip用户');
|
||||
INSERT INTO `role` VALUES (4, 'ROLE_MANAGEMENT', '管理员');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for shoucang
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `shoucang`;
|
||||
CREATE TABLE `shoucang` (
|
||||
`hid` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`newsid` bigint(20) NOT NULL COMMENT '新闻id',
|
||||
`uid` bigint(20) NOT NULL COMMENT '用户ID',
|
||||
PRIMARY KEY (`hid`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of shoucang
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for user
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `user`;
|
||||
CREATE TABLE `user` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`username` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '账号',
|
||||
`password` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码',
|
||||
`sex` tinyint(2) NOT NULL DEFAULT 1 COMMENT '性别;1:男,2:女',
|
||||
`birthday` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '生日',
|
||||
`last_login_time` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '最后登录时间',
|
||||
`score` int(11) NOT NULL DEFAULT 0 COMMENT '用户积分',
|
||||
`coin` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '金币',
|
||||
`balance` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '余额',
|
||||
`create_time` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '注册时间',
|
||||
`user_status` tinyint(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT '用户状态;0:禁用,1:正常',
|
||||
`user_nickname` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '用户昵称',
|
||||
`avatar` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '用户头像',
|
||||
`addr` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '用户地址',
|
||||
`last_login_ip` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '最后登录ip',
|
||||
`more` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '扩展属性',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户表' ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of user
|
||||
-- ----------------------------
|
||||
INSERT INTO `user` VALUES (1, 'fm453', '$2a$10$MSkMgo63VGdaw6cqOANRxeDG3NT6I20HNs792CPNNhvvMyxRccEwG', 1, '', '', 0, 0, 26.46, '', 1, '超级管理员', '', '', '', NULL);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for user_roles
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `user_roles`;
|
||||
CREATE TABLE `user_roles` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户id',
|
||||
`roles_id` int(11) NULL DEFAULT NULL COMMENT '角色id',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for weihu
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `weihu`;
|
||||
CREATE TABLE `weihu` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`isweihu` tinyint(1) NOT NULL DEFAULT 0 COMMENT '维护开关',
|
||||
`neirong` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '维护内容',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of weihu
|
||||
-- ----------------------------
|
||||
INSERT INTO `weihu` VALUES (1, 0, '维护通知:为了更好的为您服务,本站正在升级维护中,因此带来不便深表歉意');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for yijianfankui
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `yijianfankui`;
|
||||
CREATE TABLE `yijianfankui` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`username` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '反馈人账号',
|
||||
`pic` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '反馈图片',
|
||||
`content` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '反馈内容',
|
||||
`xitongbanben` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '用户手机系统版本',
|
||||
`shoujiming` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '用户手机名称',
|
||||
`shijian` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '反馈时间',
|
||||
`huifu` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '回复内容',
|
||||
`ischuli` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0显示1不显示',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of yijianfankui
|
||||
-- ----------------------------
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
56
api.php
56
api.php
@ -1,56 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-05-15T20:15:58+08:00
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2022-05-15T21:22:24+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', false);
|
||||
defined('YII_ENV') or define('YII_ENV', 'prod');
|
||||
date_default_timezone_set('PRC'); //设置时区为中国
|
||||
define('TIMESTAMP', time());
|
||||
define('HI_APP', 'dacms'); //给子项目设置的统一短标识
|
||||
|
||||
require(__DIR__ . '/version.php');
|
||||
//引用顶层文件
|
||||
require(__DIR__ . '/vendor/autoload.php');
|
||||
require(__DIR__ . '/vendor/yiisoft/yii2/Yii.php');
|
||||
require(__DIR__ . '/common/config/bootstrap.php');
|
||||
|
||||
define('YII_APP', '/dacms-api');
|
||||
//引用目标应用层文件
|
||||
require(__DIR__ . YII_APP . '/config/bootstrap.php');
|
||||
require(__DIR__ . YII_APP . '/config/cert.php') ; //定义API站点通讯并存入$_FM
|
||||
require_once(__DIR__.'/vendor/fmsoft/fmloader.php'); //引入自定义loader方法
|
||||
|
||||
$config = yii\helpers\ArrayHelper::merge(
|
||||
require(__DIR__ . '/common/config/main.php'),
|
||||
require(__DIR__ . YII_APP . '/config/main.php'),
|
||||
require(__DIR__ . YII_APP . '/config/db.php')
|
||||
);
|
||||
|
||||
fm_load()->fm_func('fm');
|
||||
fm_load()->fm_func('file');
|
||||
fm_load()->fm_func('server');
|
||||
fm_load()->fm_func('cert');
|
||||
fm_load()->fm_func('stat'); //统计处理
|
||||
fm_load()->fm_func('pdo'); //pdo操作集
|
||||
fm_load()->fm_class('dataModel'); //数据模型类集
|
||||
|
||||
$application = new yii\web\Application($config);
|
||||
$application->init();
|
||||
|
||||
/**
|
||||
* S 重设一下web根目录,以便正确引用js等 静态资源
|
||||
*/
|
||||
Yii::setAlias('@web', YII_APP.'/web');
|
||||
/**
|
||||
* E 必须在application初始化之后再设置(需要覆盖)
|
||||
*/
|
||||
|
||||
//引用或记录变量
|
||||
fm_load()->fm_vars();
|
||||
|
||||
$application->run();
|
56
api_test.php
56
api_test.php
@ -1,56 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-05-15T20:10:47+08:00
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2022-05-15T21:22:20+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', true);
|
||||
defined('YII_ENV') or define('YII_ENV', 'dev');
|
||||
date_default_timezone_set('PRC'); //设置时区为中国
|
||||
define('TIMESTAMP', time());
|
||||
define('HI_APP', 'dacms'); //给子项目设置的统一短标识
|
||||
|
||||
require(__DIR__ . '/version.php');
|
||||
//引用顶层文件
|
||||
require(__DIR__ . '/vendor/autoload.php');
|
||||
require(__DIR__ . '/vendor/yiisoft/yii2/Yii.php');
|
||||
require(__DIR__ . '/common/config/bootstrap.php');
|
||||
|
||||
define('YII_APP', '/'.HI_APP.'-api');
|
||||
//引用目标应用层文件
|
||||
require(__DIR__ . YII_APP . '/config/bootstrap.php');
|
||||
require(__DIR__ . YII_APP . '/config/cert.php') ; //定义API站点通讯并存入$_FM
|
||||
require_once(__DIR__.'/vendor/fmsoft/fmloader.php'); //引入自定义loader方法
|
||||
|
||||
$config = yii\helpers\ArrayHelper::merge(
|
||||
require(__DIR__ . '/common/config/main-local.php'),
|
||||
require(__DIR__ . YII_APP . '/config/main-local.php'),
|
||||
require(__DIR__ . YII_APP . '/config/db-local.php')
|
||||
);
|
||||
|
||||
fm_load()->fm_func('fm');
|
||||
fm_load()->fm_func('file');
|
||||
fm_load()->fm_func('server');
|
||||
fm_load()->fm_func('cert');
|
||||
fm_load()->fm_func('stat'); //统计处理
|
||||
fm_load()->fm_func('pdo'); //pdo操作集
|
||||
fm_load()->fm_class('dataModel'); //数据模型类集
|
||||
|
||||
$application = new yii\web\Application($config);
|
||||
$application->init();
|
||||
|
||||
/**
|
||||
* S 重设一下web根目录,以便正确引用js等 静态资源
|
||||
*/
|
||||
Yii::setAlias('@web', YII_APP.'/web');
|
||||
/**
|
||||
* E 必须在application初始化之后再设置(需要覆盖)
|
||||
*/
|
||||
|
||||
//引用或记录变量
|
||||
fm_load()->fm_vars();
|
||||
|
||||
$application->run();
|
@ -1 +0,0 @@
|
||||
|
@ -1,26 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<title>404</title>
|
||||
<style>
|
||||
body{
|
||||
background-color:#444;
|
||||
font-size:14px;
|
||||
}
|
||||
h3{
|
||||
font-size:60px;
|
||||
color:#eee;
|
||||
text-align:center;
|
||||
padding-top:30px;
|
||||
font-weight:normal;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h3>404,您请求的文件不存在!</h3>
|
||||
</body>
|
||||
</html>
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace backend\assets;
|
||||
|
||||
use yii\web\AssetBundle;
|
||||
|
||||
/**
|
||||
* Main backend application asset bundle.
|
||||
*/
|
||||
class AppAsset extends AssetBundle
|
||||
{
|
||||
public $basePath = '@webroot';
|
||||
public $baseUrl = '@web';
|
||||
public $css = [
|
||||
'css/site.css',
|
||||
'css/login.min.css',
|
||||
];
|
||||
public $js = [
|
||||
'js/hplus.min.js',
|
||||
];
|
||||
public $depends = [
|
||||
'yii\web\YiiAsset',
|
||||
'yii\bootstrap\BootstrapAsset',
|
||||
];
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* User: Administrator
|
||||
* Date: 2016-7-5
|
||||
* Time: 16:10
|
||||
* Description:
|
||||
*/
|
||||
|
||||
namespace backend\components;
|
||||
|
||||
|
||||
use Yii;
|
||||
use yii\rbac\Rule;
|
||||
|
||||
|
||||
class ArticleRule extends Rule
|
||||
{
|
||||
public $name = 'article';
|
||||
|
||||
public function execute($user, $item, $params)
|
||||
{
|
||||
// 这里先设置为false,逻辑上后面再完善
|
||||
return FALSE;
|
||||
}
|
||||
}
|
@ -1,98 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @Author: fm453
|
||||
* @Date: 2021-09-08 00:25:51
|
||||
* # @Last modified by: fm453
|
||||
* # @Last modified time: 2022-02-08T09:46:43+08:00
|
||||
* @Email: fm453@lukegzs.com
|
||||
*/
|
||||
|
||||
namespace backend\components;
|
||||
|
||||
use Yii;
|
||||
use common\models\CLog;
|
||||
use common\models\User;
|
||||
use common\models\Member;
|
||||
use common\models\Fans;
|
||||
use common\models\CAttachment;
|
||||
use common\models\CSms;
|
||||
use common\models\CVcode;
|
||||
|
||||
use addons\models\AcCar;
|
||||
use addons\models\AcCarOwner;
|
||||
use addons\models\AcCarBrand;
|
||||
use addons\models\AcCarSeries;
|
||||
use addons\models\AcStore;
|
||||
use addons\models\AcEmployee;
|
||||
use addons\models\AcOrder;
|
||||
use addons\models\AcOrderPre;
|
||||
use addons\models\AcOrderStatus;
|
||||
use addons\models\AcTruck;
|
||||
use addons\models\AcDriver;
|
||||
use addons\models\AcPlat;
|
||||
use addons\models\AcContact;
|
||||
|
||||
class Helper
|
||||
{
|
||||
|
||||
//历史访客数
|
||||
public static function getHistoryVisNum()
|
||||
{
|
||||
$res = CLog::find()->count();
|
||||
return $res;
|
||||
}
|
||||
|
||||
//最近一个月访问量
|
||||
public static function getMonthHistoryVisNum()
|
||||
{
|
||||
$LastMonth = strtotime("-1 month");
|
||||
$res = CLog::find()->where(['>', 'create_time', $LastMonth])->count();
|
||||
return $res;
|
||||
}
|
||||
|
||||
//API接口站用户总数
|
||||
public static function getApierCount()
|
||||
{
|
||||
$res = User::find()->count();
|
||||
return $res;
|
||||
}
|
||||
|
||||
//会员数据总数
|
||||
public static function getMemberCount()
|
||||
{
|
||||
$res = Member::find()->count();
|
||||
return $res;
|
||||
}
|
||||
|
||||
//粉丝数据总数
|
||||
public static function getFansCount()
|
||||
{
|
||||
$res = Fans::find()->count();
|
||||
return $res;
|
||||
}
|
||||
|
||||
//短信统计
|
||||
public static function getSmsStat()
|
||||
{
|
||||
$sms = CSms::find()->count();
|
||||
$mobile = CSms::find()->groupBy('mobile')->count();
|
||||
return ['sms' => $sms, 'mobile' => $mobile];
|
||||
}
|
||||
|
||||
//附件统计
|
||||
public static function getAttachStat()
|
||||
{
|
||||
$num = CAttachment::find()->count();
|
||||
$size = CAttachment::find()->sum('filesize');
|
||||
return ['num' => $num, 'size' => $size];
|
||||
}
|
||||
|
||||
//今日运单
|
||||
public static function getOrderToday()
|
||||
{
|
||||
$num = CAttachment::find()->count();
|
||||
$size = CAttachment::find()->sum('filesize');
|
||||
return ['num' => $num, 'size' => $size];
|
||||
}
|
||||
}
|
3
dacms-api/config/.gitignore
vendored
3
dacms-api/config/.gitignore
vendored
@ -1,3 +0,0 @@
|
||||
main-local.php
|
||||
params-local.php
|
||||
test-local.php
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2021-03-25T10:36:00+08:00
|
||||
# @Email: 1280880631@qq.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-08-09T09:09:28+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
Yii::setAlias('@api', dirname(__DIR__));
|
@ -1,87 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: fm453
|
||||
# @Date: 1970-01-01T08:00:00+08:00
|
||||
# @Email: fm43@hiluker.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-08-09T08:21:21+08:00
|
||||
|
||||
$params = array_merge(
|
||||
require(__DIR__ . '/../../common/config/params.php'),
|
||||
require(__DIR__ . '/../../addons-' . HI_APP . '/config/citys.php'),
|
||||
require(__DIR__ . '/../../addons-' . HI_APP . '/config/params-car.php'),
|
||||
require(__DIR__ . '/../../addons-' . HI_APP . '/config/params-letter.php'),
|
||||
require(__DIR__ . '/../../addons-' . HI_APP . '/config/params-area.php'),
|
||||
require(__DIR__ . '/../../addons-' . HI_APP . '/config/params.php'),
|
||||
// require(__DIR__ . '/../../addons-'.HI_APP.'/config/version.php'),
|
||||
require(__DIR__ . '/params.php')
|
||||
);
|
||||
|
||||
$config = [
|
||||
'id' => 'api-ctms-backend',
|
||||
'basePath' => dirname(__DIR__),
|
||||
'controllerNamespace' => 'api\controllers',
|
||||
'defaultRoute' => 'index', //默认路由
|
||||
'bootstrap' => ['log'],
|
||||
'modules' => [
|
||||
// "admin" => [
|
||||
// "class" => 'mdm\admin\Module',
|
||||
// ],
|
||||
],
|
||||
'aliases' => [
|
||||
"@mdm/admin" => "@vendor/mdmsoft/yii2-admin",
|
||||
],
|
||||
// 'as access' => [
|
||||
// //加了才会自动验证是否有权限
|
||||
// 'class' => 'mdm\admin\components\AccessControl',
|
||||
// 'allowActions' => [
|
||||
// //允许访问的action
|
||||
// //controller/action
|
||||
// '*'
|
||||
// ]
|
||||
// ],
|
||||
'language' => 'zh-CN', //目标语言
|
||||
//组件
|
||||
'components' => [
|
||||
'request' => [
|
||||
'csrfParam' => '_csrf-backend',
|
||||
'cookieValidationKey' => 'CU5iSYmIp6kbjKKuh541KsA_oaYvTuNh',
|
||||
],
|
||||
// //身份认证类
|
||||
'user' => [
|
||||
'identityClass' => 'common\models\Adminer',
|
||||
'enableAutoLogin' => true,
|
||||
'identityCookie' => ['name' => '_identity-api', 'httpOnly' => TRUE],
|
||||
],
|
||||
'session' => [
|
||||
'name' => 'advanced-ctms-api',
|
||||
],
|
||||
//Rbac权限控制
|
||||
'authManager' => [
|
||||
'class' => 'yii\rbac\DbManager',
|
||||
],
|
||||
'log' => [
|
||||
'traceLevel' => YII_DEBUG ? 3 : 0,
|
||||
'targets' => [
|
||||
[
|
||||
'class' => 'yii\log\FileTarget',
|
||||
'levels' => ['error', 'warning'],
|
||||
],
|
||||
],
|
||||
],
|
||||
'errorHandler' => [
|
||||
'errorAction' => 'site/error',
|
||||
],
|
||||
|
||||
'urlManager' => [
|
||||
'enablePrettyUrl' => TRUE,
|
||||
'showScriptName' => true,
|
||||
'suffix' => '.453', //后缀
|
||||
'rules' => [
|
||||
],
|
||||
],
|
||||
],
|
||||
'params' => $params,
|
||||
];
|
||||
|
||||
return $config;
|
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客科技(www.hiluker.cn) <Fm453>
|
||||
# @Date: 1970-01-01T08:00:00+08:00
|
||||
# @Email: fm453@hiluker.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-07-09T17:30:39+08:00
|
||||
|
||||
return [
|
||||
|
||||
];
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
return [
|
||||
'id' => 'app-backend-tests',
|
||||
'components' => [
|
||||
'assetManager' => [
|
||||
'basePath' => __DIR__ . '/../web/assets',
|
||||
],
|
||||
],
|
||||
];
|
@ -1,115 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-04-15 20:22:03
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-08-09T09:02:06+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
//前端用户入口
|
||||
|
||||
namespace api\controllers\client\v1;
|
||||
|
||||
use Yii;
|
||||
use yii\web\Controller;
|
||||
use common\models\Fans;
|
||||
|
||||
//‘from’字段为ctms的数据
|
||||
use addons\models\AcFansExt;
|
||||
|
||||
class Common extends Controller
|
||||
{
|
||||
protected $pid = 0;
|
||||
protected $user_id = 0;
|
||||
protected $site_id = 0;
|
||||
protected $user_info;
|
||||
protected $postdata = []; //重新整理一下客户端传输的数据
|
||||
protected $imgHttp = TRUE; //图片附件地址生成http(s) //false:不生成http网址; true:仅生成http网址; https:生成https网址
|
||||
protected $page = 1; //当前数据分页
|
||||
protected $pageSize = 10; //默认数据分页大小
|
||||
public $enableCsrfValidation = FALSE;
|
||||
protected $timestamp = TIMESTAMP;
|
||||
|
||||
//替代常规的_construct 析构函数;其他方法调用前执行
|
||||
|
||||
public function init()
|
||||
{
|
||||
parent::init();
|
||||
//判断请求内容类型 content-type,支持 json请求
|
||||
$postdata = Yii::$app->request->post();
|
||||
$headers = Yii::$app->request->headers;
|
||||
$contentType = $headers->get('content-type');
|
||||
if ($contentType == "application/json") {
|
||||
$postdata = json_decode(file_get_contents('php://input'), TRUE);
|
||||
}
|
||||
$this->postdata = $postdata;
|
||||
|
||||
$session = Yii::$app->session;
|
||||
if (isset($postdata['pid'])) {
|
||||
if ((int)$postdata['pid'] > 0) {
|
||||
$this->pid = (int)$postdata['pid'];
|
||||
$session->set('pid', $this->pid);
|
||||
} else {
|
||||
$session->set('pid', 0);
|
||||
}
|
||||
} else if (isset($_GET['pid'])) {
|
||||
if ((int)$_GET['pid'] > 0) {
|
||||
$this->pid = $_GET['pid'];
|
||||
$session->set('pid', $this->pid);
|
||||
} else {
|
||||
$session->set('pid', 0);
|
||||
}
|
||||
} else {
|
||||
$session->set('pid', 0);
|
||||
}
|
||||
|
||||
$this->site_id = Yii::$app->params['siteId'];
|
||||
|
||||
if (isset($postdata['uid']) && (int)$postdata['uid'] > 0) {
|
||||
$this->user_id = (int)$postdata['uid'];
|
||||
}
|
||||
if ($this->user_id) {
|
||||
$userModel = new Fans();
|
||||
$res = $userModel->findOne($this->user_id);
|
||||
if (!$res) {
|
||||
$this->user_id = 0;
|
||||
} else {
|
||||
$this->user_info = $res;
|
||||
}
|
||||
//TBD 后期需加上更多登陆验证逻辑
|
||||
}
|
||||
|
||||
$page = isset($postdata['page']) ? (int)$postdata['page'] : 1;
|
||||
$this->page = $page <= 0 ? 1 : $page;
|
||||
$pageSize = isset($postdata['psize']) ? (int)$postdata['psize'] : 10;
|
||||
$this->pageSize = $pageSize <= 0 ? 10 : $pageSize;
|
||||
}
|
||||
|
||||
public function result($msg, $data = NULL, $code = 0)
|
||||
{
|
||||
$return = [];
|
||||
$return['code'] = $code;
|
||||
$return['msg'] = $msg;
|
||||
if ($data) {
|
||||
$return['data'] = $data;
|
||||
}
|
||||
exit(json_encode($return, JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
|
||||
public function fansToken($user = [], $refresh = FALSE, $expire = NULL)
|
||||
{
|
||||
//生成token(用户数据,是否强制更新,过期时间 // TBD 具体方法有待优化
|
||||
$expire = $expire ? $expire : '+1 day';
|
||||
$token = Yii::$app->session->get('fansToken');
|
||||
$tokenExpired = Yii::$app->session->get('fansTokenExpired');
|
||||
if (!$token || $refresh) {
|
||||
$tokenExpired = strtotime($expire) * 1000;
|
||||
$token = md5('username=' . $user['username'] . '&mobile=' . $user['mobile'] . '&time=' . $tokenExpired);
|
||||
Yii::$app->session->set('fansToken', $token);
|
||||
Yii::$app->session->set('fansTokenExpired', $tokenExpired);
|
||||
}
|
||||
$user['token'] = $token;
|
||||
$user['tokenExpired'] = $tokenExpired;
|
||||
return $user;
|
||||
}
|
||||
}
|
@ -1,345 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-04-15 20:22:03
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-08-09T08:59:44+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
//前端普通用户入口
|
||||
|
||||
namespace api\controllers\client\v1;
|
||||
|
||||
use Yii;
|
||||
use common\models\Fans;
|
||||
|
||||
//‘from’字段为ctms的数据
|
||||
use addons\models\AcFansExt;
|
||||
use common\models\CSms;
|
||||
use common\models\CVcode;
|
||||
|
||||
class FansController extends Common
|
||||
{
|
||||
public function beforeAction($action)
|
||||
{
|
||||
if (!$this->pid) {
|
||||
$this->result('您正使用本系统内部接口,禁止非法链接使用!');
|
||||
}
|
||||
return parent::beforeAction($action);
|
||||
}
|
||||
|
||||
public function actionIndex()
|
||||
{
|
||||
$apis = [
|
||||
'login' => '账号密码登陆',
|
||||
'loginSms' => '手机验证码登陆',
|
||||
'detail' => '个人资料',
|
||||
'register' => '用户注册',
|
||||
'auth' => '授权登陆'
|
||||
];
|
||||
$this->result('您正使用CMTS-CLIENT系统用户管理接口!', $apis, 200);
|
||||
}
|
||||
|
||||
public function actionLogin()
|
||||
{
|
||||
$pid = $this->pid;
|
||||
$post = $this->postdata;
|
||||
|
||||
$username = $post['username'] ?? NULL;
|
||||
$passwd = $post['passwd'] ?? NULL;
|
||||
|
||||
$return = [];
|
||||
if (!$username && !$passwd) {
|
||||
$this->result('登陆参数错误!', NULL, 400);
|
||||
}
|
||||
if (!$username) {
|
||||
$this->result('请输入您的账号!', NULL, 400);
|
||||
}
|
||||
if (!$passwd) {
|
||||
$this->result('请输入您的密码!', NULL, 400);
|
||||
}
|
||||
$username = trim(htmlspecialchars_decode($username));
|
||||
$passwd = trim(htmlspecialchars_decode($passwd));
|
||||
if (!$username) {
|
||||
$this->result('输入错误,请检查您的账号!', NULL, 400);
|
||||
}
|
||||
if (!$passwd) {
|
||||
$this->result('输入有误,请检查您的密码!', NULL, 400);
|
||||
}
|
||||
|
||||
$model = new Fans();
|
||||
$from = Yii::$app->params['fansFrom']; //指定fans数据的from字段指定ctms,表示该项目的专有数据
|
||||
$condition = '(`mobile` = :username OR `email` = :username) AND `from` = :from';
|
||||
$args = [':username' => $username, ':from' => $from];
|
||||
$user = $model->find()->where($condition, $args)->one();
|
||||
if (!$user) {
|
||||
$this->result('查无此人!', NULL, 404);
|
||||
}
|
||||
|
||||
if ($user->status != Fans::STATUS_ACTIVE) {
|
||||
$this->result('账户异常,禁止登陆!', NULL, 403);
|
||||
}
|
||||
//安全校验,登陆密码
|
||||
$isPwdRight = $user->validatePassword($passwd);
|
||||
|
||||
if (!$isPwdRight) {
|
||||
$this->result('密码错误,禁止登陆!', NULL, 400);
|
||||
}
|
||||
//校验结束
|
||||
|
||||
$_user = $this->fansLogin($user, TRUE);
|
||||
$this->result('登陆成功!', ['user' => $_user], 200);
|
||||
}
|
||||
|
||||
public function actionLoginSms()
|
||||
{
|
||||
$pid = $this->pid;
|
||||
$post = $this->postdata;
|
||||
|
||||
$mobile = $post['mobile'] ?? NULL;
|
||||
$vcode = $post['vcode'] ?? NULL;
|
||||
|
||||
$return = [];
|
||||
if (!$mobile && !$vcode) {
|
||||
$this->result('登陆参数错误!', NULL, 400);
|
||||
}
|
||||
if (!$mobile) {
|
||||
$this->result('请输入您的手机号!', NULL, 400);
|
||||
}
|
||||
if (!$vcode) {
|
||||
$this->result('请输入手机验证码!', NULL, 400);
|
||||
}
|
||||
$mobile = trim(htmlspecialchars_decode($mobile));
|
||||
//验证手机号
|
||||
$isPhone = preg_match('/^1\d{10}$/', $mobile) ? TRUE : FALSE;
|
||||
if (!$isPhone) {
|
||||
$this->result('手机号不正确,请检查');
|
||||
}
|
||||
$vcode = trim(htmlspecialchars_decode($vcode));
|
||||
//验证手机验证码
|
||||
$vcodeModel = new CVcode();
|
||||
$where = [];
|
||||
$where['mobile'] = $mobile;
|
||||
$where['deleted'] = 0;
|
||||
$where['code'] = $vcode;
|
||||
$where['type'] = 'login';
|
||||
$res = $vcodeModel->find()->where($where)->one();
|
||||
if (!$res) {
|
||||
$this->result('验证码校验失败');
|
||||
}
|
||||
if (($this->timetamp - $res->create_at) > 300) {
|
||||
// 超时5分钟
|
||||
$this->result('验证码已失效,请重新获取');
|
||||
}
|
||||
|
||||
$model = new Fans();
|
||||
$from = Yii::$app->params['fansFrom']; //指定fans数据的from字段指定ctms,表示该项目的专有数据
|
||||
$condition = '`mobile` = :username AND `from` = :from';
|
||||
$args = [':username' => $mobile, ':from' => $from];
|
||||
$user = $model->find()->where($condition, $args)->one();
|
||||
$hasExt = TRUE;
|
||||
if (!$user) {
|
||||
$hasExt = FALSE;
|
||||
$userModel = clone $model;
|
||||
$user = $this->fansAdd(['mobile' => $mobile, 'from' => $from], $userModel);
|
||||
} else if ($user->status != Fans::STATUS_ACTIVE) {
|
||||
$this->result('账户异常,禁止登陆!', NULL, 403);
|
||||
}
|
||||
//校验结束
|
||||
$_user = $this->fansLogin($user, $hasExt);
|
||||
$this->result('登陆成功!', ['user' => $_user], 200);
|
||||
}
|
||||
|
||||
public function actionAuth()
|
||||
{
|
||||
$pid = $this->pid;
|
||||
$post = $this->postdata;
|
||||
$openplat = $post['from'] ?? 'uni-app'; //归属的开放平台,默认标记为了uni-app
|
||||
$mobile = isset($post['mobile']) ? trim(htmlspecialchars_decode($post['mobile'])) : '';
|
||||
$openid = isset($post['openid']) ? trim(htmlspecialchars_decode($post['openid'])) : '';
|
||||
|
||||
$return = [];
|
||||
if (!$mobile) {
|
||||
$this->result('未提供授权手机号!');
|
||||
}
|
||||
if (!$openid) {
|
||||
$this->result('未提供授权用户身份ID!');
|
||||
}
|
||||
|
||||
$model = new Fans();
|
||||
$userModel = clone $model;
|
||||
$from = Yii::$app->params['fansFrom']; //指定fans数据的from字段指定ctms,表示该项目的专有数据
|
||||
$user = $model->findOne(['mobile' => $mobile, 'from' => $from]);
|
||||
//扩展用户信息
|
||||
$AcFansExt = new AcFansExt();
|
||||
$Ext = clone $AcFansExt; //用于更新openid
|
||||
$Ext2 = clone $AcFansExt; //用于更新来源归属的开放平台openplat
|
||||
|
||||
$hasExt = TRUE;
|
||||
if (!$user) {
|
||||
$hasExt = FALSE;
|
||||
//自动注册一个新用户
|
||||
$user = $this->fansAdd(['mobile' => $mobile, 'from' => $from], $userModel);
|
||||
|
||||
// 添加扩展信息
|
||||
$Ext->pid = $this->pid;
|
||||
$Ext->mid = $user->id;
|
||||
$Ext->mobile = $mobile;
|
||||
$Ext->key = 'openid';
|
||||
$Ext->value = $openid;
|
||||
$Ext->deleted = 0;
|
||||
$Ext->save();
|
||||
|
||||
$Ext2->pid = $this->pid;
|
||||
$Ext2->mid = $user->id;
|
||||
$Ext2->mobile = $mobile;
|
||||
$Ext2->key = 'openplat';
|
||||
$Ext2->value = $openplat;
|
||||
$Ext2->deleted = 0;
|
||||
$Ext2->save();
|
||||
} else {
|
||||
//所有该用户已设置过的openid值添加一次被删除标记
|
||||
$condition = '`mid` = :mid AND `mobile` = :mobile AND `pid` = :pid AND `deleted` = :deleted AND `key` = :key AND `value` != :value';
|
||||
$args = [':mid' => $user->id, ':mobile' => $user->mobile, ':pid' => $pid, ':deleted' => 0, ':value' => $openid, ':key' => 'openid'];
|
||||
$AcFansExt->updateAllCounters(
|
||||
['deleted' => 1],
|
||||
$condition,
|
||||
$args
|
||||
);
|
||||
|
||||
$condition = '`mid` = :mid AND `mobile` = :mobile AND `pid` = :pid AND `key` = :key AND `value` = :value';
|
||||
|
||||
$args = [':mid' => $user->id, ':mobile' => $user->mobile, ':pid' => $pid, ':key' => 'openid', ':value' => $openid];
|
||||
$userExt = $Ext->find()->where($condition, $args)->one();
|
||||
if ($userExt) {
|
||||
$userExt->deleted = 0;
|
||||
$userExt->save();
|
||||
} else {
|
||||
$Ext->pid = $this->pid;
|
||||
$Ext->mid = $user->id;
|
||||
$Ext->mobile = $mobile;
|
||||
$Ext->key = 'openid';
|
||||
$Ext->value = $openid;
|
||||
$Ext->deleted = 0;
|
||||
$Ext->save();
|
||||
}
|
||||
|
||||
$args = [':mid' => $user->id, ':mobile' => $user->mobile, ':pid' => $pid, ':key' => 'openplat', ':value' => $openplat];
|
||||
$userExt2 = $Ext2->find()->where($condition, $args)->one();
|
||||
if ($userExt2) {
|
||||
$userExt2->deleted = 0;
|
||||
$userExt2->save();
|
||||
} else {
|
||||
$Ext2->pid = $this->pid;
|
||||
$Ext2->mid = $user->id;
|
||||
$Ext2->mobile = $mobile;
|
||||
$Ext2->key = 'openplat';
|
||||
$Ext2->value = $openplat;
|
||||
$Ext2->deleted = 0;
|
||||
$Ext2->save();
|
||||
}
|
||||
}
|
||||
|
||||
// 登陆用户
|
||||
$_user = $this->fansLogin($user, $hasExt);
|
||||
$this->result('登陆成功!', ['user' => $_user], 200);
|
||||
}
|
||||
|
||||
public function actionRegister()
|
||||
{
|
||||
$pid = $this->pid;
|
||||
$post = $this->postdata;
|
||||
|
||||
$mobile = isset($post['mobile']) ? trim(htmlspecialchars_decode($post['mobile'])) : '';
|
||||
$vcode = isset($post['vcode']) ? trim(htmlspecialchars_decode($post['vcode'])) : '';
|
||||
$password = isset($post['passwd']) ? trim(htmlspecialchars_decode($post['passwd'])) : '';
|
||||
$username = isset($post['username']) ? trim(htmlspecialchars_decode($post['username'])) : '';
|
||||
$email = isset($post['email']) ? trim(htmlspecialchars_decode($post['email'])) : '';
|
||||
|
||||
$return = [];
|
||||
if (!$mobile) {
|
||||
$this->result('未填写手机号!');
|
||||
}
|
||||
if (!$vcode) {
|
||||
$this->result('未填写手机验证码!');
|
||||
}
|
||||
//验证短信码
|
||||
|
||||
$model = new Fans();
|
||||
$userModel = clone $model;
|
||||
$from = Yii::$app->params['fansFrom']; //指定fans数据的from字段指定ctms,表示该项目的专有数据
|
||||
|
||||
$user = $model->findOne(['mobile' => $mobile, 'from' => $from]);
|
||||
//扩展用户信息
|
||||
$AcFansExt = new AcFansExt();
|
||||
$Ext = clone $AcFansExt;
|
||||
|
||||
if (!$user) {
|
||||
//自动注册一个新用户
|
||||
$userModel->mobile = $mobile;
|
||||
$userModel->email = $mobile . '@hiluker.com';
|
||||
$userModel->setPassword(Yii::$app->params['defaultFansPassword']);
|
||||
$userModel->generateAuthKey();
|
||||
$userModel->created_at = time();
|
||||
$userModel->from = $from;
|
||||
$userModel->save();
|
||||
$user = $userModel;
|
||||
}
|
||||
|
||||
$_user = $this->fansLogin($user, TRUE);
|
||||
$this->result('登陆成功!', ['user' => $_user], 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加一个新用户
|
||||
* @param $data 用户数据
|
||||
* @return void
|
||||
*/
|
||||
private function fansAdd($data, $userModel)
|
||||
{
|
||||
$mobile = $data['mobile'];
|
||||
$from = $data['from'] ?? Yii::$app->params['fansFrom'];
|
||||
$userModel->mobile = $mobile;
|
||||
$userModel->email = $mobile . '@hiluker.com';
|
||||
$userModel->setPassword(Yii::$app->params['defaultFansPassword']);
|
||||
$userModel->generateAuthKey();
|
||||
$userModel->created_at = time();
|
||||
$userModel->from = $from;
|
||||
$userModel->save();
|
||||
return $userModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $user 用户实例
|
||||
* @param $hasExt 有否扩展
|
||||
* @return void
|
||||
*/
|
||||
private function fansLogin($user, $hasExt = FALSE)
|
||||
{
|
||||
// 使用指定用户名获取用户身份实例
|
||||
$identity = $user;
|
||||
// 登录用户,有效期30d
|
||||
$duration = 3600 * 24 * 30;
|
||||
$_login = Yii::$app->user->login($identity, $duration);
|
||||
if (!$_login) {
|
||||
$this->result('登陆失败!', NULL, 400);
|
||||
}
|
||||
//登陆成功,返回用户信息
|
||||
$_user = ['id' => $user->id, 'username' => $user->mobile, 'mobile' => $user->mobile];
|
||||
if ($hasExt) {
|
||||
//查询关联用户的在当前系统中的扩展信息
|
||||
$AcUserExt = new AcFansExt();
|
||||
$exts = $AcUserExt->find()->where(['mid' => $user->id, 'mobile' => $user->mobile, 'pid' => $this->pid, 'deleted' => 0])->all();
|
||||
if ($exts) {
|
||||
foreach ($exts as $ext) {
|
||||
$_user[$ext['key']] = $ext['value'];
|
||||
}
|
||||
}
|
||||
}
|
||||
//生成token(用户数据,是否强制更新,过期时间
|
||||
$isLong = $this->postdata['isLong'] || FALSE;
|
||||
$expire = $isLong ? '+1 Month' : FALSE;
|
||||
$_user = $this->fansToken($_user, $refresh = TRUE, $expire);
|
||||
return $_user;
|
||||
}
|
||||
}
|
@ -1,188 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-05-13T09:20:03+08:00
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-08-09T08:59:48+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
|
||||
//主入口页
|
||||
|
||||
namespace api\controllers\client\v1;
|
||||
|
||||
use Yii;
|
||||
use yii\data\Pagination;
|
||||
use addons\models\AcCar;
|
||||
use addons\models\AcCarOwner;
|
||||
use addons\models\AcCarBrand;
|
||||
use addons\models\AcCarSeries;
|
||||
use addons\models\AcStore;
|
||||
use addons\models\AcEmployee;
|
||||
use addons\models\AcOrder;
|
||||
use addons\models\AcOrderPre;
|
||||
use addons\models\AcOrderStatus;
|
||||
use addons\models\AcTruck;
|
||||
use addons\models\AcDriver;
|
||||
use addons\models\AcPlat;
|
||||
use common\models\CVcode;
|
||||
use addons\models\AcContact;
|
||||
use common\models\Member as User;
|
||||
use addons\models\AcUserExt;
|
||||
|
||||
class IndexController extends Common
|
||||
{
|
||||
public function beforeAction($action)
|
||||
{
|
||||
if (!$this->pid) {
|
||||
$this->result('您正使用本系统内部接口,禁止非法链接使用!');
|
||||
}
|
||||
return parent::beforeAction($action);
|
||||
}
|
||||
|
||||
public function actionIndex()
|
||||
{
|
||||
$apis = [
|
||||
'h5data' => '拉取APP首页数据',
|
||||
];
|
||||
$this->result('您正使用CMTS系统接口!', $apis, 200);
|
||||
}
|
||||
|
||||
public function actionAdsSplash()
|
||||
{
|
||||
$ads = [
|
||||
// "http://public.hiluker.com/ctms/client/app-kp/kp01.jpg",
|
||||
"http://public.hiluker.com/ctms/client/app-kp/kp03.jpg",
|
||||
];
|
||||
$this->result('开屏广告!', $ads, 200);
|
||||
}
|
||||
|
||||
public function actionAdsBanner()
|
||||
{
|
||||
$ads = [
|
||||
'0' => [
|
||||
"image" => 'http://public.hiluker.com/ctms/client/app-banner/banner01.jpg',
|
||||
"link" => '/pages/uni-starter/ucenter/ucenter'
|
||||
],
|
||||
'1' => [
|
||||
"image" => 'http://public.hiluker.com/ctms/client/app-banner/banner03.jpg',
|
||||
"link" => 'http://ctms.hiluker.cn'
|
||||
],
|
||||
'2' => [
|
||||
"image" => 'http://public.hiluker.com/ctms/client/app-banner/banner02.jpg',
|
||||
"link" => ''
|
||||
]
|
||||
];
|
||||
$this->result('BANNER广告!', $ads, 200);
|
||||
}
|
||||
|
||||
public function actionH5data()
|
||||
{
|
||||
$session = Yii::$app->session;
|
||||
$pid = $this->pid;
|
||||
|
||||
$model = new AcOrder();
|
||||
$search = $where = $orwhere = [];
|
||||
$where[] = 'and';
|
||||
$where[] = ['=', 'pid', $pid];
|
||||
$deleted = 0;
|
||||
$where[] = ['=', 'deleted', $deleted]; //排除已删除运单
|
||||
$status_code = -1;
|
||||
$where[] = ['<>', 'status_code', $status_code]; //排除已取消运单
|
||||
|
||||
$start = date('Y-m-d 00:00:00'); //今日0点
|
||||
// $start = date('2020-08-29 00:00:00'); //测试时段
|
||||
$start = strtotime($start);
|
||||
|
||||
$end = date('Y-m-d H:i:s'); //当前时间点
|
||||
// $end = date('2021-09-04 00:00:00'); //测试时段
|
||||
$end = strtotime($end);
|
||||
|
||||
//今日运单
|
||||
$_where = $where;
|
||||
$_where[] = ['=', 'is_turnover', 0]; //排除交车单
|
||||
$_where[] = ['between', 'sign_date', $start, $end];
|
||||
$data = $model->find()->where($_where);
|
||||
$order_today_count = $data->count();
|
||||
//今日交车
|
||||
$_where = $where;
|
||||
$_where[] = ['=', 'is_turnover', 1]; //交车单
|
||||
$_where[] = ['between', 'sign_date', $start, $end];
|
||||
$data = $model->find()->where($_where);
|
||||
$jiaoche_today_count = $data->count();
|
||||
//今日录单
|
||||
$_where = $where;
|
||||
$_where[] = ['between', 'create_at', $start, $end];
|
||||
$data = $model->find()->where($_where);
|
||||
$order_today_create = $data->count();
|
||||
|
||||
//昨日
|
||||
$_end = $start;
|
||||
$_start = date('Y-m-d 00:00:00', strtotime("-1 day"));
|
||||
$_start = strtotime($_start);
|
||||
//昨日运单
|
||||
$_where = $where;
|
||||
$_where[] = ['=', 'is_turnover', 0]; //排除交车单
|
||||
$_where[] = ['between', 'sign_date', $_start, $_end];
|
||||
$data = $model->find()->where($_where);
|
||||
$order_yesterday_count = $data->count();
|
||||
//昨日交车
|
||||
$_where = $where;
|
||||
$_where[] = ['=', 'is_turnover', 1]; //交车单
|
||||
$_where[] = ['between', 'sign_date', $_start, $_end];
|
||||
$data = $model->find()->where($_where);
|
||||
$jiaoche_yesterday_count = $data->count();
|
||||
//昨日录单
|
||||
$_where = $where;
|
||||
$_where[] = ['between', 'create_at', $_start, $_end];
|
||||
$data = $model->find()->where($_where);
|
||||
$order_yesterday_create = $data->count();
|
||||
|
||||
//本月起始时间点
|
||||
$_start = date('Y-m-01 00:00:00');
|
||||
$ldm = strtotime("last day of " . $_start);
|
||||
$m = date("Y-m-d", $ldm) . " 23:59:59";
|
||||
$_start = strtotime($_start);
|
||||
$_end = strtotime($m);
|
||||
//本月运单
|
||||
$_where = $where;
|
||||
$_where[] = ['=', 'is_turnover', 0]; //排除交车单
|
||||
$_where[] = ['between', 'sign_date', $_start, $_end];
|
||||
$data = $model->find()->where($_where);
|
||||
$order_month_count = $data->count();
|
||||
//本月交车
|
||||
$_where = $where;
|
||||
$_where[] = ['=', 'is_turnover', 1];
|
||||
$_where[] = ['between', 'sign_date', $_start, $_end];
|
||||
$data = $model->find()->where($_where);
|
||||
$jiaoche_month_count = $data->count();
|
||||
|
||||
//累计运单
|
||||
$_where = $where;
|
||||
$_where[] = ['=', 'is_turnover', 0]; //排除交车单
|
||||
$data = $model->find()->where($_where);
|
||||
$order_all_count = $data->count();
|
||||
//累计交车
|
||||
$_where = $where;
|
||||
$_where[] = ['=', 'is_turnover', 1];
|
||||
$data = $model->find()->where($_where);
|
||||
$jiaoche_all_count = $data->count();
|
||||
|
||||
$return = [];
|
||||
$return['code'] = 200;
|
||||
$return['msg'] = '首页数据下载!';
|
||||
$return['data'] = [
|
||||
'orderToday' => $order_today_count,
|
||||
'orderYesterday' => $order_yesterday_count,
|
||||
'orderMonth' => $order_month_count,
|
||||
'orderTotal' => $order_all_count,
|
||||
'jiaocheToday' => $jiaoche_today_count,
|
||||
'jiaocheYesterday' => $jiaoche_yesterday_count,
|
||||
'jiaocheMonth' => $jiaoche_month_count,
|
||||
'jiaocheTotal' => $jiaoche_all_count,
|
||||
'notice' => 0
|
||||
];
|
||||
exit(json_encode($return, JSON_UNESCAPED_UNICODE | JSON_FORCE_OBJECT));
|
||||
}
|
||||
}
|
@ -1,201 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2024-08-03T15:34:01+08:00
|
||||
# @Email: 1280880631@qq.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-08-09T09:00:02+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
namespace api\controllers\client\v1;
|
||||
|
||||
use addons\models\AcNews;
|
||||
use addons\models\AcNewsCat;
|
||||
use Yii;
|
||||
use yii\data\Pagination;
|
||||
use yii\helpers\Url;
|
||||
|
||||
class NewsController extends Common
|
||||
{
|
||||
public function beforeAction($action)
|
||||
{
|
||||
if (!$this->pid) {
|
||||
$this->result('您正使用本系统内部接口,禁止非法链接使用!');
|
||||
}
|
||||
return parent::beforeAction($action);
|
||||
}
|
||||
|
||||
public function actionIndex()
|
||||
{
|
||||
$apis = [
|
||||
'list' => '文章清单',
|
||||
'detail' => '文章详情'
|
||||
];
|
||||
$this->result('您正使用CMTS-CLIENT系统文章内容管理接口!', $apis, 200);
|
||||
}
|
||||
|
||||
//订单列表
|
||||
public function actionList()
|
||||
{
|
||||
$s = $this->search(['is_show' => 1]);
|
||||
$res = $s['res'];
|
||||
if (!$res) {
|
||||
$this->result('没有查询到相应的数据!', [], 0);
|
||||
}
|
||||
$data = $s['data'];
|
||||
$list = $this->formatList($res);
|
||||
|
||||
$return = [
|
||||
'total' => $data->count(),
|
||||
'news' => $list,
|
||||
'page' => $this->page
|
||||
];
|
||||
$this->result('内容查询成功!', $return, 200);
|
||||
}
|
||||
|
||||
public function actionDetail()
|
||||
{
|
||||
$pid = $this->pid;
|
||||
$post = $this->postdata;
|
||||
|
||||
$id = $post['id'] ?? 0;
|
||||
if ($id <= 0) {
|
||||
$this->result('查询参数错误!');
|
||||
}
|
||||
$model = new AcNews();
|
||||
$detail = $model->findOne($id);
|
||||
$s = $this->formatDetail($detail->toArray());
|
||||
$this->result('查询成功!', $s, 200);
|
||||
}
|
||||
|
||||
public function actionAjax()
|
||||
{
|
||||
$post = $this->postdata;
|
||||
$id = $post['id'] ?? 0;
|
||||
if ($id <= 0) {
|
||||
$this->result('未指定内容!');
|
||||
}
|
||||
$model = new AcNews();
|
||||
$detail = $model->findOne($id);
|
||||
if (!$detail) {
|
||||
$this->result('指定的内容不存在!');
|
||||
}
|
||||
if ($detail->deleted) {
|
||||
$this->result('指定的内容已被删除!');
|
||||
}
|
||||
$op = $post['op'] ?? '';
|
||||
if (!$op) {
|
||||
$this->result('无有效指令!');
|
||||
}
|
||||
switch ($op) {
|
||||
case 'read':
|
||||
$detail->reading += 1;
|
||||
break;
|
||||
case 'no_read':
|
||||
$detail->reading -= 1;
|
||||
$detail->reading = $detail->reading < 0 ? 0 : $detail->reading;
|
||||
break;
|
||||
case 'like':
|
||||
$detail->liked += 1;
|
||||
break;
|
||||
case 'no_like':
|
||||
$detail->liked -= 1;
|
||||
$detail->liked = $detail->liked < 0 ? 0 : $detail->liked;
|
||||
break;
|
||||
case 'view':
|
||||
$detail->viewed += 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
$detail->save();
|
||||
$data = $this->formatDetail($detail->toArray());
|
||||
$this->result('已执行', $data, 200);
|
||||
}
|
||||
|
||||
private function search($ops = [])
|
||||
{
|
||||
$pid = $this->pid;
|
||||
$model = new AcNews();
|
||||
$where = '`pid` = :pid';
|
||||
$params = [':pid' => $pid];
|
||||
$post = $this->postdata;
|
||||
$search = isset($post['search']) ? $post['search'] : [];
|
||||
// 优先处理$ops传参,并同时删除$search中相应元素
|
||||
if ($ops) {
|
||||
foreach ($ops as $key => $value) {
|
||||
$where .= ' AND `' . $key . '` = :' . $key;
|
||||
$params[':' . $key] = $value;
|
||||
if (isset($search[$key])) {
|
||||
unset($search[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($search['title'])) {
|
||||
$search['title'] = trim($search['title']);
|
||||
$where .= ' AND `title` like :title';
|
||||
$params[':title'] = '%' . $search['title'] . '%';
|
||||
}
|
||||
if (!empty($search['cid'])) {
|
||||
$search['cid'] = intval($search['cid']);
|
||||
$where .= ' AND `cid` = :cid';
|
||||
$params[':cid'] = $search['cid'];
|
||||
}
|
||||
|
||||
if (!isset($params[':deleted'])) {
|
||||
$params[':deleted'] = 0;
|
||||
$where .= ' AND `deleted` = :deleted';
|
||||
}
|
||||
|
||||
$page = $this->page;
|
||||
$pageSize = $this->pageSize;
|
||||
$data = $model->find()->where($where, $params);
|
||||
$pages = new Pagination(['totalCount' => $data->count(), 'pageSize' => $pageSize]);
|
||||
$pages->setPage($page - 1, TRUE); //设置分页的当前页面值
|
||||
$_orderby = 'orderby DESC,update_at DESC,id DESC';
|
||||
$res = $data->offset($pages->offset)->limit($pages->limit)->orderby($_orderby)->all();
|
||||
return ['res' => $res, 'data' => $data];
|
||||
}
|
||||
|
||||
|
||||
private function formatList($res)
|
||||
{
|
||||
$unsets = ['pid', 'create_at', 'deleted'];
|
||||
$list = [];
|
||||
foreach ($res as $s) {
|
||||
$s = $s->toArray();
|
||||
foreach ($unsets as $us) {
|
||||
unset($s[$us]);
|
||||
}
|
||||
|
||||
$weekdays = [0 => '日', 1 => '一', 2 => '二', 3 => '三', 4 => '四', 5 => '五', 6 => '六'];
|
||||
$wk = date('w', $s['update_at']);
|
||||
$s['updateTime'] = date('Y-m-d ', $s['update_at']) . '星期' . $weekdays[$wk];
|
||||
|
||||
$s['content'] = $s['content'] ? htmlspecialchars_decode($s['content']) : '';
|
||||
|
||||
$list[] = $s;
|
||||
}
|
||||
unset($s);
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
private function formatDetail($s = [])
|
||||
{
|
||||
$unsets = ['pid', 'create_at', 'deleted', 'is_show'];
|
||||
foreach ($unsets as $us) {
|
||||
unset($s[$us]);
|
||||
}
|
||||
$weekdays = [0 => '日', 1 => '一', 2 => '二', 3 => '三', 4 => '四', 5 => '五', 6 => '六'];
|
||||
$wk = date('w', $s['update_at']);
|
||||
$s['updateTime'] = date('Y-m-d ', $s['update_at']) . '星期' . $weekdays[$wk];
|
||||
$s['content'] = htmlspecialchars_decode($s['content']);
|
||||
|
||||
// 'src="/upload/pics/'
|
||||
$upload_url = 'https://dacms.hiluker.cn';
|
||||
$s['content'] = str_replace('src="/upload/pics/', 'src="' . $upload_url . '/upload/pics/', $s['content']);
|
||||
return $s;
|
||||
}
|
||||
}
|
@ -1,117 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2024-08-03T16:38:33+08:00
|
||||
# @Email: 1280880631@qq.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-08-09T08:59:58+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
namespace api\controllers\client\v1;
|
||||
|
||||
use addons\models\AcNewsCat;
|
||||
use yii\data\Pagination;
|
||||
|
||||
class NewscatController extends Common
|
||||
{
|
||||
public function beforeAction($action)
|
||||
{
|
||||
if (!$this->pid) {
|
||||
$this->result('您正使用本系统内部接口,禁止非法链接使用!');
|
||||
}
|
||||
return parent::beforeAction($action);
|
||||
}
|
||||
|
||||
public function actionIndex()
|
||||
{
|
||||
$apis = [
|
||||
'list' => '分类清单'
|
||||
];
|
||||
$this->result('您正使用CMTS-CLIENT系统内容分类管理接口!', $apis, 200);
|
||||
}
|
||||
|
||||
//列表
|
||||
public function actionList()
|
||||
{
|
||||
$s = $this->search(['is_show' => 1]);
|
||||
$res = $s['res'];
|
||||
if (!$res) {
|
||||
$this->result('没有查询到相应的数据!', [], 0);
|
||||
}
|
||||
$list = $this->formatList($res);
|
||||
|
||||
$return = [
|
||||
'cats' => $list
|
||||
];
|
||||
$this->result('通知查询成功!', $return, 200);
|
||||
}
|
||||
|
||||
private function search($ops = [])
|
||||
{
|
||||
$pid = $this->pid;
|
||||
$model = new AcNewsCat();
|
||||
$where = 'pid = :pid';
|
||||
$params = [':pid' => $pid];
|
||||
$post = $this->postdata;
|
||||
$search = isset($post['search']) ? $post['search'] : [];
|
||||
// 优先处理$ops传参,并同时删除$search中相应元素
|
||||
if ($ops) {
|
||||
foreach ($ops as $key => $value) {
|
||||
$where .= ' & ' . $key . ' = :' . $key;
|
||||
$params[':' . $key] = $value;
|
||||
if (isset($search[$key])) {
|
||||
unset($search[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($search['title'])) {
|
||||
$search['title'] = trim($search['title']);
|
||||
$where .= ' & title like :title';
|
||||
$params[':title'] = $search['title'];
|
||||
}
|
||||
|
||||
if (!isset($params[':deleted'])) {
|
||||
$params[':deleted'] = 0;
|
||||
$where .= ' & deleted = :deleted';
|
||||
}
|
||||
|
||||
$page = 1;
|
||||
$pageSize = 10;
|
||||
$data = $model->find()->where($where, $params);
|
||||
$pages = new Pagination(['totalCount' => $data->count(), 'pageSize' => $pageSize]);
|
||||
$pages->setPage($page - 1, TRUE); //设置分页的当前页面值
|
||||
$_orderby = 'orderby DESC,update_at DESC,id DESC';
|
||||
$res = $data->offset($pages->offset)->limit($pages->limit)->orderby($_orderby)->all();
|
||||
return ['res' => $res, 'data' => $data];
|
||||
}
|
||||
|
||||
|
||||
private function formatList($res)
|
||||
{
|
||||
$unsets = ['pid', 'create_at', 'deleted', 'update_at'];
|
||||
$list = [];
|
||||
foreach ($res as $s) {
|
||||
$s = $s->toArray();
|
||||
foreach ($unsets as $us) {
|
||||
unset($s[$us]);
|
||||
}
|
||||
$list[] = $s;
|
||||
}
|
||||
unset($s);
|
||||
return $list;
|
||||
}
|
||||
|
||||
private function formatDetail($s = [])
|
||||
{
|
||||
$unsets = ['pid', 'create_at', 'deleted', 'is_show'];
|
||||
foreach ($unsets as $us) {
|
||||
unset($s[$us]);
|
||||
}
|
||||
$weekdays = [0 => '日', 1 => '一', 2 => '二', 3 => '三', 4 => '四', 5 => '五', 6 => '六'];
|
||||
$wk = date('w', $s['update_at']);
|
||||
$s['updateTime'] = date('Y-m-d ', $s['update_at']) . '星期' . $weekdays[$wk];
|
||||
$s['des'] = htmlspecialchars_decode($s['des']);
|
||||
return $s;
|
||||
}
|
||||
}
|
@ -1,141 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2024-08-02T01:08:31+08:00
|
||||
# @Email: 1280880631@qq.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-08-09T09:00:06+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
namespace api\controllers\client\v1;
|
||||
|
||||
use addons\models\AcNotice;
|
||||
use yii\data\Pagination;
|
||||
|
||||
class NoticeController extends Common
|
||||
{
|
||||
public function beforeAction($action)
|
||||
{
|
||||
if (!$this->pid) {
|
||||
$this->result('您正使用本系统内部接口,禁止非法链接使用!');
|
||||
}
|
||||
return parent::beforeAction($action);
|
||||
}
|
||||
|
||||
public function actionIndex()
|
||||
{
|
||||
$apis = [
|
||||
'list' => '通知清单',
|
||||
'detail' => '通知详情'
|
||||
];
|
||||
$this->result('您正使用CMTS-CLIENT系统通知管理接口!', $apis, 200);
|
||||
}
|
||||
|
||||
//订单列表
|
||||
public function actionList()
|
||||
{
|
||||
// $s = $this->search(['is_show'=>1]);
|
||||
$s = $this->search();
|
||||
$res = $s['res'];
|
||||
if (!$res) {
|
||||
$this->result('没有查询到相应的数据!', [], 0);
|
||||
}
|
||||
$data = $s['data'];
|
||||
$list = $this->formatList($res);
|
||||
|
||||
$return = [
|
||||
'total' => $data->count(),
|
||||
'notices' => $list,
|
||||
'page' => $this->page
|
||||
];
|
||||
$this->result('通知查询成功!', $return, 200);
|
||||
}
|
||||
|
||||
public function actionDetail()
|
||||
{
|
||||
$pid = $this->pid;
|
||||
$post = $this->postdata;
|
||||
|
||||
$id = isset($post['id']) ? $post['id'] : 0;
|
||||
if ($id <= 0) {
|
||||
$this->result('查询参数错误!');
|
||||
}
|
||||
$model = new AcNotice();
|
||||
$detail = $model->findOne($id);
|
||||
$s = $this->formatDetail($detail->toArray());
|
||||
$this->result('查询成功!', $s, 200);
|
||||
}
|
||||
|
||||
private function search($ops = [])
|
||||
{
|
||||
$pid = $this->pid;
|
||||
$model = new AcNotice();
|
||||
$where = 'pid = :pid';
|
||||
$params = [':pid' => $pid];
|
||||
$post = $this->postdata;
|
||||
$search = isset($post['search']) ? $post['search'] : [];
|
||||
// 优先处理$ops传参,并同时删除$search中相应元素
|
||||
if ($ops) {
|
||||
foreach ($ops as $key => $value) {
|
||||
$where .= ' & ' . $key . ' = :' . $key;
|
||||
$params[':' . $key] = $value;
|
||||
if (isset($search[$key])) {
|
||||
unset($search[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($search['title']) && !empty($search['title'])) {
|
||||
$search['title'] = trim($search['title']);
|
||||
$where .= ' & title like :title';
|
||||
$params[':title'] = $search['title'];
|
||||
}
|
||||
|
||||
if (!isset($params[':deleted'])) {
|
||||
$params[':deleted'] = 0;
|
||||
$where .= ' & deleted = :deleted';
|
||||
}
|
||||
|
||||
$page = $this->page;
|
||||
$pageSize = $this->pageSize;
|
||||
$data = $model->find()->where($where, $params);
|
||||
$pages = new Pagination(['totalCount' => $data->count(), 'pageSize' => $pageSize]);
|
||||
$pages->setPage($page - 1, TRUE); //设置分页的当前页面值
|
||||
$_orderby = 'update_at DESC,id DESC';
|
||||
$res = $data->offset($pages->offset)->limit($pages->limit)->orderby($_orderby)->all();
|
||||
return ['res' => $res, 'data' => $data];
|
||||
}
|
||||
|
||||
|
||||
private function formatList($res)
|
||||
{
|
||||
$unsets = ['pid', 'create_at', 'deleted'];
|
||||
$list = [];
|
||||
foreach ($res as $s) {
|
||||
$s = $s->toArray();
|
||||
foreach ($unsets as $us) {
|
||||
unset($s[$us]);
|
||||
}
|
||||
|
||||
$weekdays = [0 => '日', 1 => '一', 2 => '二', 3 => '三', 4 => '四', 5 => '五', 6 => '六'];
|
||||
$wk = date('w', $s['update_at']);
|
||||
$s['updateTime'] = date('Y-m-d ', $s['update_at']) . '星期' . $weekdays[$wk];
|
||||
$list[] = $s;
|
||||
}
|
||||
unset($s);
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
private function formatDetail($s = [])
|
||||
{
|
||||
$unsets = ['pid', 'create_at', 'deleted', 'is_show'];
|
||||
foreach ($unsets as $us) {
|
||||
unset($s[$us]);
|
||||
}
|
||||
$weekdays = [0 => '日', 1 => '一', 2 => '二', 3 => '三', 4 => '四', 5 => '五', 6 => '六'];
|
||||
$wk = date('w', $s['update_at']);
|
||||
$s['updateTime'] = date('Y-m-d ', $s['update_at']) . '星期' . $weekdays[$wk];
|
||||
return $s;
|
||||
}
|
||||
}
|
@ -1,707 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-04-24T20:28:47+08:00
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-08-09T09:00:15+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
namespace api\controllers\client\v1;
|
||||
|
||||
use Yii;
|
||||
use yii\data\Pagination;
|
||||
use yii\helpers\Url;
|
||||
use backend\controllers\client\v1\Common;
|
||||
use addons\models\AcCar;
|
||||
use addons\models\AcCarOwner;
|
||||
use addons\models\AcCarBrand;
|
||||
use addons\models\AcCarSeries;
|
||||
use addons\models\AcStore;
|
||||
use addons\models\AcEmployee;
|
||||
use addons\models\AcOrder;
|
||||
use addons\models\AcOrderPre;
|
||||
use addons\models\AcOrderStatus;
|
||||
use addons\models\AcTruck;
|
||||
use addons\models\AcDriver;
|
||||
use addons\models\AcPlat;
|
||||
use common\models\CVcode;
|
||||
use addons\models\AcContact;
|
||||
use common\models\Member as User;
|
||||
use addons\models\AcUserExt;
|
||||
use common\models\Fans;
|
||||
use addons\models\AcFansExt;
|
||||
|
||||
class OrderController extends Common
|
||||
{
|
||||
public function beforeAction($action)
|
||||
{
|
||||
if (!$this->pid) {
|
||||
// $this->result('您正使用本系统内部接口,禁止非法链接使用!');
|
||||
}
|
||||
return parent::beforeAction($action);
|
||||
}
|
||||
|
||||
public function actionIndex()
|
||||
{
|
||||
$apis = [
|
||||
'list' => '搜索运单',
|
||||
'detail' => '运单详情',
|
||||
'create' => '创建运单'
|
||||
];
|
||||
$this->result('您正使用CMTS-CLIENT系统订单管理接口!', $apis, 200);
|
||||
}
|
||||
|
||||
//订单列表
|
||||
public function actionList()
|
||||
{
|
||||
$s = $this->search();
|
||||
$res = $s['res'];
|
||||
if (!$res) {
|
||||
$this->result('没有查询到相应的数据!', [], 0);
|
||||
}
|
||||
$data = $s['data'];
|
||||
$this->showOrder($res, $data);
|
||||
}
|
||||
|
||||
public function actionDetail()
|
||||
{
|
||||
$pid = $this->pid;
|
||||
$status = Yii::$app->params['OrderStatus'];
|
||||
$post = $this->postdata;
|
||||
|
||||
$id = isset($post['oid']) ? $post['oid'] : 0;
|
||||
if ($id <= 0) {
|
||||
$this->result('查询参数错误!');
|
||||
}
|
||||
$AcOrder = new AcOrder();
|
||||
$order = $AcOrder->findOne($id);
|
||||
$detail = $order->toArray();
|
||||
$detail['thumbs'] = $detail['thumbs'] ? json_decode($detail['thumbs']) : [];
|
||||
|
||||
$model = new AcStore();
|
||||
$store = $model->findOne($detail['store_id']);
|
||||
if ($store) {
|
||||
$detail['store_title'] = $store->title;
|
||||
}
|
||||
|
||||
$model = new AcEmployee();
|
||||
$employee = $model->findOne($detail['employee_id']);
|
||||
if ($employee) {
|
||||
$detail['employee_title'] = $employee->name;
|
||||
}
|
||||
|
||||
$detail['car_owner_id'] = $detail['car_brand_id'] = $detail['car_series_id'] = 0;
|
||||
$model = new AcCar();
|
||||
$car = $model->findOne($detail['car_id']);
|
||||
if ($car) {
|
||||
$detail['car_owner_id'] = $car->owner_id;
|
||||
$detail['car_brand_id'] = $car->brand_id;
|
||||
$detail['car_series_id'] = $car->series_id;
|
||||
$detail['car_number'] = $car->num_p . $car->num_area . $car->num_left;
|
||||
$detail['car_number'] = $detail['car_number'] ? $detail['car_number'] : $car->num_frame;
|
||||
}
|
||||
|
||||
$model = new User();
|
||||
$user = $model->findOne($detail['from_mid']);
|
||||
|
||||
$model = new AcUserExt();
|
||||
$exts = [];
|
||||
$_exts = $model->find()->where(['mid' => $detail['from_mid'], 'pid' => $pid, 'deleted' => 0])->indexBy('id')->all();
|
||||
foreach ($_exts as $ext) {
|
||||
$ext = $ext->toArray();
|
||||
if (isset($users[$s['id']])) {
|
||||
if ($ext['mobile'] == $user->mobile) {
|
||||
$exts[$ext['mid']][$ext['key']] = $ext['value'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$AcCarOwner = new AcCarOwner();
|
||||
$owner = $AcCarOwner->findOne($detail['car_owner_id']);
|
||||
if ($owner) {
|
||||
$_owner = User::findOne($detail['car_owner_id']);
|
||||
$detail['car_owner'] = $_owner->username . '【' . $_owner->mobile . '】';
|
||||
}
|
||||
|
||||
$AcCarBrand = new AcCarBrand();
|
||||
$brand = $AcCarBrand->findOne($detail['car_brand_id']);
|
||||
if ($brand) {
|
||||
$detail['car_title'] = $brand->title;
|
||||
}
|
||||
|
||||
$AcCarSeries = new AcCarSeries();
|
||||
$where = [];
|
||||
$series = $AcCarSeries->findOne($detail['car_series_id']);
|
||||
if ($series) {
|
||||
$detail['car_title'] .= $series->title;
|
||||
}
|
||||
|
||||
$sn = '00000000000'; //11位
|
||||
$sn = substr($sn, 0, 11 - strlen($id));
|
||||
$sn .= $id;
|
||||
$detail['sn'] = $sn;
|
||||
|
||||
$weekdays = [0 => '日', 1 => '一', 2 => '二', 3 => '三', 4 => '四', 5 => '五', 6 => '六'];
|
||||
$wk = date('w', $detail['sign_date']);
|
||||
$detail['signdate'] = date('Y-m-d 星期' . $weekdays[$wk], $detail['sign_date']);
|
||||
$detail['from_province'] = isset($detail['start_province']) ? Yii::$app->params['regionAreas'][$detail['start_province']] : '';
|
||||
$detail['to_province'] = isset($detail['aim_province']) ? Yii::$app->params['regionAreas'][$detail['aim_province']] : '';
|
||||
$detail['remark'] = $detail['remark'] || '';
|
||||
$detail['remark'] = trim($detail['remark']) ? htmlspecialchars_decode(trim($detail['remark'])) : '';
|
||||
|
||||
$imgDir = Yii::getAlias('@upload');
|
||||
$imgKeys = ['driving_lisence', 'thumb_f', 'thumb_b', 'thumb_l', 'thumb_r'];
|
||||
foreach ($imgKeys as $k) {
|
||||
$detail[$k] = $detail[$k] ? $detail[$k] : '/pics/nopic.jpg';
|
||||
$url_pre = substr($detail[$k], 0, 4);
|
||||
if ($url_pre == '/pic') {
|
||||
$detail[$k . '_url'] = Url::to('@upload' . $detail[$k], $this->imgHttp);
|
||||
} else if ($url_pre == 'http') {
|
||||
$detail[$k . '_url'] = $detail[$k];
|
||||
}
|
||||
}
|
||||
|
||||
if ($detail['thumbs']) {
|
||||
$thumbs = $detail['thumbs'];
|
||||
$thumbs_url = [];
|
||||
foreach ($thumbs as $k => $v) {
|
||||
$url_pre = substr($v, 0, 4);
|
||||
if ($url_pre == '/pic') {
|
||||
$v_url = Url::to('@upload' . $v, $this->imgHttp);
|
||||
} else if ($url_pre == 'http') {
|
||||
$v_url = $v;
|
||||
}
|
||||
$thumbs_url[] = ['src' => $v, 'url' => $v_url];
|
||||
}
|
||||
$detail['thumbs_url'] = $thumbs_url;
|
||||
}
|
||||
|
||||
$unsets = ['commission', 'commission_left', 'fee_truck', 'create_at', 'create_by', 'deleted', 'income', 'expense', 'fee_deliver', 'fee_extra', 'fee_insurance', 'fee_pickup', 'fee_urgent', 'from_bid', 'from_mid', 'is_commission', 'is_cwqr', 'is_holdon', 'is_over', 'pay_receive_pids', 'pay_send_pids', 'pre_id'];
|
||||
foreach ($unsets as $us) {
|
||||
unset($detail[$us]);
|
||||
}
|
||||
|
||||
$this->result('订单查询成功!', $detail, 200);
|
||||
}
|
||||
|
||||
public function actionCreate()
|
||||
{
|
||||
$get = Yii::$app->request->get();
|
||||
$post = $this->postdata;
|
||||
$pid = $this->pid;
|
||||
|
||||
//格式化数据 为空的项则不修改
|
||||
//目标键=》POST键
|
||||
$cols = ['start_province' => 'start_province', 'start_city' => 'start_city', 'aim_province' => 'aim_province', 'aim_city' => 'aim_city', 'aim_address' => 'aim_address',
|
||||
'signer' => 'signer', 'bind' => 'bind', 'wtdw' => "wtdw",
|
||||
'sender_name' => 'sender_name', 'sender_idcard' => 'sender_idcard', 'sender_mobiles' => 'sender_mobiles',
|
||||
'receiver_name' => 'receiver_name', 'receiver_idcard' => 'receiver_idcard', 'receiver_mobiles' => 'receiver_mobiles',
|
||||
'car_extra' => 'car_extra'];
|
||||
foreach ($cols as $col => $key) {
|
||||
if (isset($post[$key]) && $post[$key] != '') {
|
||||
$data[$col] = trim($post[$key]);
|
||||
}
|
||||
}
|
||||
//'car_id'=>'car_id','employee_id'=>'employee_id',
|
||||
$cols = ['car_value' => 'car_value', 'fee_insurance' => 'fee_insurance', 'fee_truck' => 'fee_truck', 'fee_deliver' => 'fee_deliver', 'fee_pickup' => 'fee_pickup', 'fee_urgent' => 'fee_urgent', 'fee_extra' => 'fee_extra', 'fee_total' => 'fee_total', 'pay_send' => 'pay_send', 'pay_receive' => 'pay_receive', 'not_insurance' => 'not_insurance', 'weituo' => 'weituo'];
|
||||
foreach ($cols as $col => $key) {
|
||||
$data[$col] = 0;
|
||||
if (isset($post[$key]) && $post[$key] != '') {
|
||||
$data[$col] = (int)$post[$key];
|
||||
}
|
||||
}
|
||||
|
||||
$cols = ['remark' => 'remark'];
|
||||
foreach ($cols as $col => $key) {
|
||||
if (isset($post[$key]) && $post[$key] != '') {
|
||||
$data[$col] = htmlspecialchars($post[$key]);
|
||||
}
|
||||
}
|
||||
$data['remark'] = isset($data['remark']) ? isset($data['remark']) : '';
|
||||
|
||||
/*@sign_date: 1649952000000*/
|
||||
$sign_date = isset($post['sign_date']) ? $post['sign_date'] / 1000 : '';
|
||||
$data['sign_date'] = $sign_date ? $sign_date : time();
|
||||
|
||||
$mid = isset($post['mid']) ? (int)$post['mid'] : 11; //11是方孟
|
||||
$data['create_by'] = $mid;
|
||||
$data['is_cwqr'] = 0; //修改财务确认状态为待确认
|
||||
$data['status_code'] = 1; //订单处于创建待审核状态
|
||||
|
||||
//部分规则校验
|
||||
$hasError = 0;
|
||||
$msg = '';
|
||||
$fee_total = $data['fee_truck'] + $data['fee_insurance'] + $data['fee_deliver'] + $data['fee_pickup'] + $data['fee_urgent'] + $data['fee_extra'];
|
||||
$fee_pay = $data['pay_send'] + $data['pay_receive'];
|
||||
if (!$data['fee_truck']) {
|
||||
$hasError += 1;
|
||||
$msg .= '请注意,运费未正确填写!';
|
||||
}
|
||||
|
||||
if ($fee_total != $data['fee_total']) {
|
||||
$hasError += 1;
|
||||
$msg .= '所填各项费用汇总的值与所填写的总费用不一致!';
|
||||
}
|
||||
if ($fee_pay != $data['fee_total']) {
|
||||
$hasError += 1;
|
||||
$msg .= '所填现付与到收费用汇总的值与所填写的总费用不一致!';
|
||||
}
|
||||
|
||||
$data['create_at'] = time();
|
||||
$data['update_at'] = $data['create_at'];
|
||||
$data['pid'] = $pid;
|
||||
|
||||
$data['employee_id'] = isset($post['employee_id']) ? (int)$post['employee_id'] : 1; //1是宫雪
|
||||
$data['store_id'] = 0;
|
||||
$model = new AcEmployee();
|
||||
$employee = $model->findOne($data['employee_id']);
|
||||
if ($employee) {
|
||||
$data['store_id'] = $employee->store_id;
|
||||
}
|
||||
|
||||
//校验生成部分补充数据
|
||||
//生成现付说明
|
||||
$payments = [
|
||||
'wechat' => '微信',
|
||||
'alipay' => '支付宝',
|
||||
'cash' => '现金',
|
||||
'bankcard' => '银行卡',
|
||||
'bankunion' => '银联',
|
||||
'others' => '其他'
|
||||
];
|
||||
if ($post['pay_send']) {
|
||||
$txt = $post['payto'] . '收款' . $post['pay_send'] . '元(' . $payments[$post['payment']] . ')';
|
||||
if ($data['remark']) {
|
||||
$data['remark'] .= ' ; ' . $txt;
|
||||
} else {
|
||||
$data['remark'] = $txt;
|
||||
}
|
||||
}
|
||||
//生成车辆信息
|
||||
$carModel = new AcCar();
|
||||
$where = [];
|
||||
if ($post['isTempCarno']) {
|
||||
$post['carno_left'] .= '临';
|
||||
}
|
||||
if (empty($post['carno_frame'])) {
|
||||
$where['num_p'] = $post['carno_p'];
|
||||
$where['num_area'] = $post['carno_area'];
|
||||
$where['num_left'] = $post['carno_left'];
|
||||
}
|
||||
$post['carno_frame'] = isset($post['carno_frame']) ? $post['carno_frame'] : '';
|
||||
if (!empty($post['carno_frame'])) {
|
||||
$where['num_frame'] = $post['carno_frame'];
|
||||
}
|
||||
$car = $carModel->find()->where($where)->one();
|
||||
if (empty($car)) {
|
||||
$carModel->pid = $pid;
|
||||
$carModel->num_frame = $post['carno_frame'];
|
||||
$carModel->num_p = $post['carno_p'];
|
||||
$carModel->num_area = $post['carno_area'];
|
||||
$carModel->num_left = $post['carno_left'];
|
||||
$carModel->title = $post['carno_title'];
|
||||
$carModel->title = $post['carno_title'];
|
||||
$carModel->status_code = 1;
|
||||
$carModel->create_at = time();
|
||||
$carModel->update_at = time();
|
||||
$carModel->save();
|
||||
$car_id = $carModel->attributes['id'];
|
||||
} else {
|
||||
$car_id = $car->id;
|
||||
}
|
||||
$data['car_id'] = $car_id;
|
||||
|
||||
//查询联系人信息是否在库
|
||||
$sender_mobiles = isset($data['sender_mobiles']) ? $data['sender_mobiles'] : NULL;
|
||||
$receiver_mobiles = isset($data['receiver_mobiles']) ? $data['receiver_mobiles'] : NULL;
|
||||
if ($sender_mobiles) {
|
||||
//项目分支自有数据表
|
||||
$contactModel = new AcContact();
|
||||
$contactor = $contactModel->find()->where(['mobile' => $data['sender_mobiles'], 'pid' => $pid])->one();
|
||||
if (empty($contactor)) {
|
||||
$contactModel->name = isset($data['sender_name']) ? $data['sender_name'] : '客户';
|
||||
$contactModel->mobile = $data['sender_mobiles'];
|
||||
$contactModel->pid = $pid;
|
||||
$contactModel->idcard = isset($data['sender_idcard']) ? $data['sender_idcard'] : '';
|
||||
$contactModel->create_at = time();
|
||||
$contactModel->status_code = 1;
|
||||
$contactModel->save();
|
||||
} else {
|
||||
$_contactDatas = [];
|
||||
$_contactDatas['name'] = isset($data['sender_name']) ? $data['sender_name'] : $contactModel->name;
|
||||
$_contactDatas['idcard'] = isset($data['idcard']) ? $data['idcard'] : $contactModel->idcard;
|
||||
if ($_contactDatas['name'] == $contactModel->name && $_contactDatas['idcard'] == $contactModel->idcard) {
|
||||
//无须做任何变化
|
||||
} else {
|
||||
$_contactDatas['update_at'] = time();
|
||||
$contactModel->updateAll($_contactDatas, ['id' => $contactModel->id]);
|
||||
}
|
||||
}
|
||||
|
||||
//框架核心数据表Fans
|
||||
$userModel = new Fans();
|
||||
$user = $userModel->findByUsername($sender_mobiles);
|
||||
if (empty($user)) {
|
||||
$userModel->mobile = $sender_mobiles;
|
||||
$userModel->email = $sender_mobiles . '@hiluker.com';
|
||||
$userModel->setPassword(Yii::$app->params['defaultFansPassword']);
|
||||
$userModel->generateAuthKey();
|
||||
$userModel->created_at = time();
|
||||
$userModel->from = 'ctms';
|
||||
$userModel->save();
|
||||
}
|
||||
}
|
||||
if ($receiver_mobiles && $receiver_mobiles != $sender_mobiles) {
|
||||
//项目分支自有数据表
|
||||
$contactModel2 = new AcContact();
|
||||
$contactor2 = $contactModel2->find()->where(['mobile' => $data['receiver_mobiles'], 'pid' => $pid])->one();
|
||||
if (empty($contactor2)) {
|
||||
$contactModel2->name = isset($data['receiver_name']) ? $data['receiver_name'] : '客户';
|
||||
$contactModel2->mobile = $data['receiver_mobiles'];
|
||||
$contactModel2->pid = $pid;
|
||||
$contactModel2->idcard = isset($data['receiver_idcard']) ? $data['receiver_idcard'] : '';
|
||||
$contactModel2->create_at = time();
|
||||
$contactModel2->status_code = 1;
|
||||
$contactModel2->save();
|
||||
} else {
|
||||
$_contactDatas = [];
|
||||
$_contactDatas['name'] = isset($data['receiver_name']) ? $data['receiver_name'] : $contactModel2->name;
|
||||
$_contactDatas['idcard'] = isset($data['idcard']) ? $data['idcard'] : $contactModel2->idcard;
|
||||
if ($_contactDatas['name'] == $contactModel2->name && $_contactDatas['idcard'] == $contactModel2->idcard) {
|
||||
//无须做任何变化
|
||||
} else {
|
||||
$_contactDatas['update_at'] = time();
|
||||
$contactModel2->updateAll($_contactDatas, ['id' => $contactModel2->id]);
|
||||
}
|
||||
}
|
||||
//框架核心数据表Fans
|
||||
$userModel = new Fans();
|
||||
$user = $userModel->findByUsername($receiver_mobiles);
|
||||
if (empty($user)) {
|
||||
$userModel->mobile = $receiver_mobiles;
|
||||
$userModel->email = $receiver_mobiles . '@hiluker.com';
|
||||
$userModel->setPassword(Yii::$app->params['defaultFansPassword']);
|
||||
$userModel->generateAuthKey();
|
||||
$userModel->created_at = time();
|
||||
$userModel->from = 'ctms';
|
||||
$userModel->save();
|
||||
}
|
||||
}
|
||||
|
||||
//保存资料
|
||||
$AcOrder = new AcOrder();
|
||||
foreach ($data as $key => $val) {
|
||||
$AcOrder->$key = $val;
|
||||
}
|
||||
|
||||
$res = $AcOrder->save();
|
||||
$id = $AcOrder->attributes['id']; //获取插入后id
|
||||
|
||||
if ($res) {
|
||||
$return = [];
|
||||
$return['code'] = 200;
|
||||
$return['msg'] = '订单保存成功!' . $msg;
|
||||
$return['data'] = ['id' => $id];
|
||||
exit(json_encode($return, JSON_UNESCAPED_UNICODE | JSON_FORCE_OBJECT));
|
||||
} else {
|
||||
$return = [];
|
||||
$return['code'] = 100;
|
||||
$return['msg'] = '订单保存失败!';
|
||||
$return['data'] = [];
|
||||
exit(json_encode($return, JSON_UNESCAPED_UNICODE | JSON_FORCE_OBJECT));
|
||||
}
|
||||
}
|
||||
|
||||
//订单列表
|
||||
private function search()
|
||||
{
|
||||
$pid = $this->pid;
|
||||
$return = [];
|
||||
$model = new AcOrder();
|
||||
$where = [];
|
||||
$where[] = 'and';
|
||||
$where[] = ['=', 'pid', $pid];
|
||||
|
||||
$post = $this->postdata;
|
||||
$search = isset($post['search']) ? $post['search'] : [];
|
||||
//预置搜索条件,只允许查询与自己完全相关的订单
|
||||
$search['phone'] = $this->user_info->mobile;
|
||||
$orwhere = ['or', ['LIKE', 'sender_mobiles', $search['phone']], ['LIKE', 'receiver_mobiles', $search['phone']]];
|
||||
|
||||
//车牌号使用完整精准搜索(皖A88888)
|
||||
$CarModel = new AcCar();
|
||||
if (isset($search['carno']) && !empty($search['carno'])) {
|
||||
$search['carno'] = trim($search['carno']);
|
||||
$sql = 'CONCAT(num_p,num_area,num_left) = :carno or num_frame LIKE :carno';
|
||||
$cars = $CarModel->find()->where($sql, [':carno' => $search['carno']])->limit(5)->offset(0)->all();
|
||||
|
||||
//最多仅显示可匹配车牌号的前5个
|
||||
if (empty($cars)) {
|
||||
$return['code'] = 400;
|
||||
$return['msg'] = '未查询到相关车辆';
|
||||
return ['res' => FALSE, 'data' => $return];
|
||||
} else {
|
||||
$car_ids = [];
|
||||
foreach ($cars as $car) {
|
||||
$car_ids[] = $car->id;
|
||||
}
|
||||
$where[] = ['IN', 'car_id', $car_ids];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($search['city']) && !empty($search['city'])) {
|
||||
$search['city'] = trim($search['city']);
|
||||
$where[] = ['LIKE', 'aim_city', $search['city']];
|
||||
}
|
||||
|
||||
$search['employee'] = isset($search['employee']) ? (int)$search['employee'] : '';
|
||||
$EmployeeModel = new AcEmployee();
|
||||
if (!empty($search['employee'])) {
|
||||
$where[] = ['=', 'employee_id', $search['employee']];
|
||||
$employee = $EmployeeModel->findOne($search['employee']);
|
||||
$search['employee_title'] = isset($employee->name) ? $employee->name : '';
|
||||
}
|
||||
$search['store_id'] = isset($search['store_id']) ? (int)$search['store_id'] : '';
|
||||
if (empty($search['sotre_id'])) {
|
||||
$search['store_id'] = isset($get['store_id']) ? (int)$get['store_id'] : 0;
|
||||
}
|
||||
$StoreModel = new AcStore();
|
||||
if (!empty($search['store_id'])) {
|
||||
$where[] = ['=', 'store_id', $search['store_id']];
|
||||
$store = $StoreModel->findOne($search['store_id']);
|
||||
$search['store_title'] = isset($store->title) ? $store->title : '';
|
||||
}
|
||||
|
||||
$search['start_province'] = isset($search['start_province']) ? trim($search['start_province']) : '';
|
||||
if (!empty($search['start_province'])) {
|
||||
$where[] = ['=', 'start_province', $search['start_province']];
|
||||
}
|
||||
$search['start_city'] = isset($search['start_city']) ? trim($search['start_city']) : '';
|
||||
if (!empty($search['start_city'])) {
|
||||
$where[] = ['LIKE', 'start_city', $search['start_city']];
|
||||
}
|
||||
$search['aim_province'] = isset($search['aim_province']) ? trim($search['aim_province']) : '';
|
||||
if (!empty($search['aim_province'])) {
|
||||
$where[] = ['=', 'aim_province', $search['aim_province']];
|
||||
}
|
||||
$search['aim_city'] = isset($search['aim_city']) ? trim($search['aim_city']) : '';
|
||||
if (!empty($search['aim_city'])) {
|
||||
$where[] = ['LIKE', 'aim_city', $search['aim_city']];
|
||||
}
|
||||
$search['signer'] = isset($search['signer']) ? trim($search['signer']) : '';
|
||||
$search['wtdw'] = isset($search['wtdw']) ? trim($search['wtdw']) : '';
|
||||
$search['weituo'] = isset($search['weituo']) ? (int)$search['weituo'] : 0;
|
||||
if ($search['weituo']) {
|
||||
$where[] = ['=', 'weituo', $search['weituo']];
|
||||
} else if (!empty($search['wtdw'])) {
|
||||
$where[] = ['LIKE', 'wtdw', $search['wtdw']];
|
||||
} else if (!empty($search['signer'])) {
|
||||
$where[] = ['LIKE', 'signer', $search['signer']];
|
||||
}
|
||||
|
||||
$search['sender_name'] = isset($search['sender_name']) ? trim($search['sender_name']) : '';
|
||||
if (!empty($search['sender_name'])) {
|
||||
$where[] = ['LIKE', 'sender_name', $search['sender_name']];
|
||||
}
|
||||
$search['receiver_name'] = isset($search['receiver_name']) ? trim($search['receiver_name']) : '';
|
||||
if (!empty($search['receiver_name'])) {
|
||||
$where[] = ['LIKE', 'receiver_name', $search['receiver_name']];
|
||||
}
|
||||
$search['bind'] = isset($search['bind']) ? trim($search['bind']) : '';
|
||||
if (!empty($search['bind'])) {
|
||||
$where[] = ['LIKE', 'bind', $search['bind']];
|
||||
}
|
||||
if (isset($search['status_code']) && $search['status_code'] != 'all') {
|
||||
$search['status_code'] = (int)$search['status_code'];
|
||||
$where[] = ['=', 'status_code', $search['status_code']];
|
||||
} else {
|
||||
unset($search['status_code']);
|
||||
}
|
||||
|
||||
if (isset($search['is_holdon'])) {
|
||||
$search['is_holdon'] = (int)$search['is_holdon'];
|
||||
$where[] = ['=', 'is_holdon', $search['is_holdon']];
|
||||
}
|
||||
if (isset($search['is_over'])) {
|
||||
$search['is_over'] = (int)$search['is_over'];
|
||||
$where[] = ['=', 'is_over', $search['is_over']];
|
||||
}
|
||||
if (isset($search['is_commission'])) {
|
||||
$search['is_commission'] = (int)$search['is_commission'];
|
||||
$where[] = ['=', 'is_commission', $search['is_commission']];
|
||||
}
|
||||
$search['is_cwqr'] = isset($search['is_cwqr']) ? $search['is_cwqr'] : '';
|
||||
if ($search['is_cwqr'] == '') {
|
||||
$search['is_cwqr'] = isset($get['is_cwqr']) ? $get['is_cwqr'] : '';
|
||||
}
|
||||
if ($search['is_cwqr'] != '') {
|
||||
$search['is_cwqr'] = (int)$get['is_cwqr'];
|
||||
$where[] = ['=', 'is_cwqr', $search['is_cwqr']];
|
||||
}
|
||||
|
||||
//签约时间筛选
|
||||
$search['sign_m'] = isset($search['sign_m']) ? $search['sign_m'] : '';
|
||||
$search['sign_after'] = isset($search['sign_after']) ? $search['sign_after'] : '';
|
||||
$search['sign_before'] = isset($search['sign_before']) ? $search['sign_before'] : '';
|
||||
//按月份筛选
|
||||
if (!empty($search['sign_m'])) {
|
||||
$start = strtotime($search['sign_m']);
|
||||
$s = date("Y-m-d H:i:s", $start);
|
||||
$ldm = strtotime("last day of " . $s);
|
||||
$m = date("Y-m-d", $ldm) . " 23:59:59";
|
||||
$end = strtotime($m);
|
||||
$where[] = ['between', 'sign_date', $start, $end];
|
||||
} //按指定时段筛选
|
||||
else if (!empty($search['sign_after']) && !empty($search['sign_before'])) {
|
||||
$start = strtotime($search['sign_after']);
|
||||
$end = strtotime($search['sign_before']);
|
||||
$where[] = ['between', 'sign_date', $start, $end];
|
||||
} //按指定时间临界点筛选(以不早于为优先筛选条件)
|
||||
else if (!empty($search['sign_after'])) {
|
||||
$start = strtotime($search['sign_after']);
|
||||
$where[] = ['>=', 'sign_date', $start];
|
||||
} else if (!empty($search['sign_before'])) {
|
||||
$end = strtotime($search['sign_before']);
|
||||
$where[] = ['<=', 'sign_date', $end];
|
||||
}
|
||||
|
||||
//带序列号搜索(TBD:后期考虑改为精准唯一搜索)
|
||||
if (isset($search['sn']) && $search['sn'] != 'undefined' && $search['sn']) {
|
||||
$where[] = ['LIKE', 'sn', $search['sn']];
|
||||
}
|
||||
|
||||
$deleted = 0;
|
||||
$where[] = ['=', 'deleted', $deleted];
|
||||
$where[] = ['=', 'is_turnover', 0]; //排除交车单
|
||||
|
||||
$page = $this->page;
|
||||
$pageSize = $this->pageSize;
|
||||
$data = $model->find()->where($where)->andwhere($orwhere);
|
||||
$pages = new Pagination(['totalCount' => $data->count(), 'pageSize' => $pageSize]);
|
||||
$pages->setPage($page - 1, TRUE); //设置分页的当前页面值
|
||||
$_orderby = 'sign_date DESC,id DESC';
|
||||
$res = $data->offset($pages->offset)->limit($pages->limit)->orderby($_orderby)->all();
|
||||
|
||||
return ['res' => $res, 'data' => $data];
|
||||
}
|
||||
|
||||
/*
|
||||
订单数据显示格式化
|
||||
*/
|
||||
private function showOrder($orderRes, $data)
|
||||
{
|
||||
$status = Yii::$app->params['OrderStatus'];
|
||||
|
||||
$cids = $sids = $eids = $mids = [];
|
||||
if ($orderRes) {
|
||||
foreach ($orderRes as $r) {
|
||||
$cids[$r->car_id] = $r->car_id;
|
||||
$sids[$r->store_id] = $r->store_id;
|
||||
$eids[$r->employee_id] = $r->employee_id;
|
||||
$mids[$r->from_mid] = $r->from_mid;
|
||||
}
|
||||
}
|
||||
|
||||
$model = new AcStore();
|
||||
$where = [];
|
||||
$where['pid'] = Yii::$app->session->get('pid');
|
||||
$_stores = $model->find()->where(['in', 'id', $sids])->all();
|
||||
$stores = [];
|
||||
foreach ($_stores as $s) {
|
||||
$stores[$s->id] = $s->toArray();
|
||||
}
|
||||
|
||||
$model = new AcEmployee();
|
||||
$employees = [];
|
||||
$_employees = $model->find()->where(['in', 'id', $eids])->indexBy('id')->all();
|
||||
foreach ($_employees as $s) {
|
||||
$employees[$s->id] = $s->toArray();
|
||||
}
|
||||
|
||||
$model = new User();
|
||||
$users = [];
|
||||
$_users = $model->find()->where(['in', 'id', $mids])->all();
|
||||
foreach ($_users as $s) {
|
||||
$s = $s->toArray();
|
||||
$users[$s['id']] = $s;
|
||||
}
|
||||
|
||||
$model = new AcCar();
|
||||
$cars = [];
|
||||
$_cars = $model->find()->where(['in', 'id', $cids])->indexBy('id')->all();
|
||||
$bids = $sids = [];
|
||||
foreach ($_cars as $s) {
|
||||
$bids[] = $s->brand_id;
|
||||
$sids[] = $s->series_id;
|
||||
$cars[$s->id] = $s->toArray();
|
||||
}
|
||||
unset($s);
|
||||
|
||||
$model = new AcCarBrand();
|
||||
$brands = $model->find()->where(['in', 'id', $bids])->indexBy('id')->all();
|
||||
$model = new AcCarSeries();
|
||||
$series = $model->find()->where(['in', 'id', $sids])->indexBy('id')->all();
|
||||
|
||||
if ($cars) {
|
||||
foreach ($cars as &$car) {
|
||||
$car['title2'] = '';
|
||||
if (isset($brands[$car['brand_id']])) {
|
||||
$car['title2'] .= $brands[$car['brand_id']]['title'];
|
||||
}
|
||||
if (isset($series[$car['series_id']])) {
|
||||
$car['title2'] .= $series[$car['series_id']]['title'];
|
||||
}
|
||||
$car['number2'] = $car['num_frame'];
|
||||
if ($car['num_p']) {
|
||||
$car['number2'] = $car['num_p'];
|
||||
}
|
||||
if ($car['num_area']) {
|
||||
$car['number2'] .= $car['num_area'];
|
||||
}
|
||||
if ($car['num_left']) {
|
||||
$car['number2'] .= $car['num_left'];
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($car);
|
||||
|
||||
$orders = [];
|
||||
$unsets = ['pid', 'commission', 'commission_left', 'fee_truck', 'create_at', 'create_by', 'deleted', 'income', 'expense', 'fee_deliver', 'fee_extra', 'fee_insurance', 'fee_pickup', 'fee_urgent', 'from_bid', 'from_mid', 'is_commission', 'is_cwqr', 'is_holdon', 'is_over', 'pay_receive_pids', 'pay_send_pids', 'pre_id', 'remark', 'car_extra', 'thumb_b', 'thumb_f', 'thumb_l', 'thumb_r', 'thumbs', 'driving_lisence', 'videos'];
|
||||
|
||||
foreach ($orderRes as $s) {
|
||||
$car = [];
|
||||
if ($s->car_id) {
|
||||
$car = $cars[$s->car_id];
|
||||
}
|
||||
$s = $s->toArray();
|
||||
foreach ($unsets as $us) {
|
||||
unset($s[$us]);
|
||||
}
|
||||
$weekdays = [0 => '日', 1 => '一', 2 => '二', 3 => '三', 4 => '四', 5 => '五', 6 => '六'];
|
||||
$wk = date('w', $s['sign_date']);
|
||||
$s['signdate'] = date('Y-m-d ', $s['sign_date']) . '星期' . $weekdays[$wk];
|
||||
$s['from_province'] = $s['start_province'] ? Yii::$app->params['regionAreas'][$s['start_province']] : '';
|
||||
$s['to_province'] = $s['aim_province'] ? Yii::$app->params['regionAreas'][$s['aim_province']] : '';
|
||||
$s['car_number'] = isset($car['number2']) ? $car['number2'] : '';
|
||||
$s['car_title'] = isset($car['title']) ? $car['title'] : '';
|
||||
$s['car_title'] = $s['car_title'] ? $s['car_title'] : (isset($car['title2']) ? $car['title2'] : '');
|
||||
$s['status'] = $status[$s['status_code']];
|
||||
$orders[] = $s;
|
||||
}
|
||||
unset($s);
|
||||
|
||||
$return = [];
|
||||
$return['code'] = 200;
|
||||
$return['msg'] = '订单查询成功!';
|
||||
$return['data'] = [
|
||||
'total' => $data->count(),
|
||||
'orders' => $orders,
|
||||
'employees' => $employees,
|
||||
'stores' => $stores,
|
||||
'users' => $users,
|
||||
'page' => $this->page
|
||||
];
|
||||
exit(json_encode($return, JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
}
|
@ -1,199 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-04-24T20:28:47+08:00
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-08-09T09:00:10+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
namespace api\controllers\client\v1;
|
||||
|
||||
use Yii;
|
||||
use yii\data\Pagination;
|
||||
|
||||
use addons\models\AcOrder;
|
||||
|
||||
class OrdercheckController extends Common
|
||||
{
|
||||
public function beforeAction($action)
|
||||
{
|
||||
if (!$this->pid) {
|
||||
$this->result('您正使用本系统内部接口,禁止非法链接使用!');
|
||||
}
|
||||
return parent::beforeAction($action);
|
||||
}
|
||||
|
||||
public function actionIndex()
|
||||
{
|
||||
$apis = [
|
||||
'basic' => '基础验车', //启运网点
|
||||
'online' => '中转验车',
|
||||
'arrive' => '到站验车', //目的地网点
|
||||
];
|
||||
$this->result('您正使用CMTS系统运单验车管理接口!', $apis, 200);
|
||||
}
|
||||
|
||||
public function actionBasic()
|
||||
{
|
||||
$pid = $this->pid;
|
||||
$status = Yii::$app->params['OrderStatus'];
|
||||
$post = $this->postdata;
|
||||
|
||||
$id = isset($post['oid']) ? $post['oid'] : 0;
|
||||
if ($id <= 0) {
|
||||
$this->result('查询参数错误!');
|
||||
}
|
||||
$AcOrder = new AcOrder();
|
||||
$order = $AcOrder->findOne($id);
|
||||
if (!$order) {
|
||||
$this->result('该运单数据不存在!');
|
||||
}
|
||||
if (!isset($post['checks'])) {
|
||||
$this->result('验车参数错误!');
|
||||
}
|
||||
$checks = $post['checks']; //需要更新的验车信息
|
||||
//判断执行权限 S
|
||||
if (!$this->user_info) {
|
||||
$this->result('无有效用户登陆信息,无权操作!');
|
||||
}
|
||||
if (!$this->user_id !== $order->from_mid) {
|
||||
// $this->result('不是当前用户的运单,无权操作!');
|
||||
}
|
||||
//判断执行权限 E
|
||||
$hasChange = 0; //是否有需要更新的数据
|
||||
$op = isset($post['op']) ? $post['op'] : '';
|
||||
$isOss = TRUE; //是否启用OSS服务
|
||||
switch ($op) {
|
||||
case 'data':
|
||||
$hasChange = 1;
|
||||
$checker = isset($checks['checker']) ? trim($checks['checker']) : '';
|
||||
$order->checker = $checker ? $checker : $this->user_info->username;
|
||||
$start_km = isset($checks['start_km']) ? (int)$checks['start_km'] : 0;
|
||||
$order->start_km = $start_km;
|
||||
$is_driving_lisence = isset($checks['is_driving_lisence']) ? (int)$checks['is_driving_lisence'] : 0;
|
||||
$order->no_driving_lisence = $is_driving_lisence == 1 ? 1 : 0;
|
||||
$car_extra = isset($checks['car_extra']) ? trim($checks['car_extra']) : '';
|
||||
$order->car_extra = $car_extra;
|
||||
break;
|
||||
case 'driving_lisence':
|
||||
$k = 'driving_lisence';
|
||||
if (isset($checks[$k]) && $checks[$k]) {
|
||||
if (!$isOss) {
|
||||
$file = Yii::getAlias('@upload-src') . $checks[$k];
|
||||
if (file_exists($file)) {
|
||||
$hasChange = 1;
|
||||
$order->$k = $checks[$k];
|
||||
}
|
||||
} else {
|
||||
$hasChange = 1;
|
||||
$order->$k = $checks[$k];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'thumb_f':
|
||||
$k = 'thumb_f';
|
||||
if (isset($checks[$k]) && $checks[$k]) {
|
||||
if (!$isOss) {
|
||||
$file = Yii::getAlias('@upload-src') . $checks[$k];
|
||||
if (file_exists($file)) {
|
||||
$hasChange = 1;
|
||||
$order->$k = $checks[$k];
|
||||
}
|
||||
} else {
|
||||
$hasChange = 1;
|
||||
$order->$k = $checks[$k];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'thumb_b':
|
||||
$k = 'thumb_b';
|
||||
if (isset($checks[$k]) && $checks[$k]) {
|
||||
$file = Yii::getAlias('@upload-src') . $checks[$k];
|
||||
if (file_exists($file)) {
|
||||
$hasChange = 1;
|
||||
$order->$k = $checks[$k];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'thumb_l':
|
||||
$k = 'thumb_l';
|
||||
if (isset($checks[$k]) && $checks[$k]) {
|
||||
if (!$isOss) {
|
||||
$file = Yii::getAlias('@upload-src') . $checks[$k];
|
||||
if (file_exists($file)) {
|
||||
$hasChange = 1;
|
||||
$order->$k = $checks[$k];
|
||||
}
|
||||
} else {
|
||||
$hasChange = 1;
|
||||
$order->$k = $checks[$k];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'thumb_r':
|
||||
$k = 'thumb_r';
|
||||
if (isset($checks[$k]) && $checks[$k]) {
|
||||
if (!$isOss) {
|
||||
$file = Yii::getAlias('@upload-src') . $checks[$k];
|
||||
if (file_exists($file)) {
|
||||
$hasChange = 1;
|
||||
$order->$k = $checks[$k];
|
||||
}
|
||||
} else {
|
||||
$hasChange = 1;
|
||||
$order->$k = $checks[$k];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'thumbs':
|
||||
$k = 'thumbs';
|
||||
if (isset($checks[$k]) && $checks[$k]) {
|
||||
$hasChange = 1;
|
||||
$thumbs = json_encode($checks[$k]);
|
||||
$order->$k = $thumbs;
|
||||
}
|
||||
break;
|
||||
case 'all':
|
||||
$keys = ['driving_lisence', 'thumb_f', 'thumb_b', 'thumb_l', 'thumb_r'];
|
||||
foreach ($keys as $k) {
|
||||
if (isset($checks[$k]) && $checks[$k]) {
|
||||
if (!$isOss) {
|
||||
$file = Yii::getAlias('@upload-src') . $checks[$k];
|
||||
if (file_exists($file)) {
|
||||
$hasChange = 1;
|
||||
$order->$k = $checks[$k];
|
||||
}
|
||||
} else {
|
||||
$hasChange = 1;
|
||||
$order->$k = $checks[$k];
|
||||
}
|
||||
}
|
||||
}
|
||||
$k = 'thumbs';
|
||||
if (isset($checks[$k]) && $checks[$k]) {
|
||||
$hasChange = 1;
|
||||
$thumbs = json_encode($checks[$k]);
|
||||
$order->$k = $thumbs;
|
||||
}
|
||||
$checker = isset($checks['checker']) ? trim($checks['checker']) : '';
|
||||
$order->checker = $checker ? $checker : $this->user_info->username;
|
||||
$start_km = isset($checks['start_km']) ? (int)$checks['start_km'] : 0;
|
||||
$order->start_km = $start_km;
|
||||
$is_driving_lisence = isset($checks['is_driving_lisence']) ? (int)$checks['is_driving_lisence'] : 0;
|
||||
$order->no_driving_lisence = $is_driving_lisence == 1 ? 1 : 0;
|
||||
$car_extra = isset($checks['car_extra']) ? trim($checks['car_extra']) : '';
|
||||
$order->car_extra = $car_extra;
|
||||
if ($hasChange) {
|
||||
$order->is_checked = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if ($hasChange) {
|
||||
$res = $order->save();
|
||||
$this->result('操作完成!', $order->toArray(), 200);
|
||||
} else {
|
||||
$this->result('没有要更新的数据!', NULL, 200);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,418 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-04-24T20:28:47+08:00
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-08-09T09:00:19+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
namespace api\controllers\client\v1;
|
||||
|
||||
use addons\models\AcEmployee;
|
||||
use addons\models\AcOrderPre;
|
||||
use addons\models\AcStore;
|
||||
use Yii;
|
||||
use yii\data\Pagination;
|
||||
|
||||
class OrderpreController extends Common
|
||||
{
|
||||
public function beforeAction($action)
|
||||
{
|
||||
if (!$this->pid) {
|
||||
$this->result('您正使用本系统内部接口,禁止非法链接使用!');
|
||||
}
|
||||
return parent::beforeAction($action);
|
||||
}
|
||||
|
||||
public function actionIndex()
|
||||
{
|
||||
$apis = [
|
||||
'list' => '搜索询单',
|
||||
'detail' => '询单详情',
|
||||
'create' => '创建询单'
|
||||
];
|
||||
$this->result('您正使用CMTS-CLIENT系统询价单管理接口!', $apis, 200);
|
||||
}
|
||||
|
||||
//订单列表
|
||||
public function actionList()
|
||||
{
|
||||
$s = $this->search();
|
||||
$res = $s['res'];
|
||||
if (!$res) {
|
||||
$this->result('没有查询到相应的数据!', [], 0);
|
||||
}
|
||||
$data = $s['data'];
|
||||
$this->showOrder($res, $data);
|
||||
}
|
||||
|
||||
private function search()
|
||||
{
|
||||
$pid = $this->pid;
|
||||
$return = [];
|
||||
$model = new AcOrderPre();
|
||||
$where = $orwhere = [];
|
||||
$where[] = 'and';
|
||||
$where[] = ['=', 'pid', $pid];
|
||||
|
||||
$post = $this->postdata;
|
||||
$search = isset($post['search']) ? $post['search'] : [];
|
||||
//预置搜索条件,只允许查询与自己完全相关的订单
|
||||
$where[] = ['=', 'from_uid', $this->user_id];
|
||||
$search['phone'] = $this->user_info->mobile;
|
||||
$where[] = ['=', 'from_mobile', $search['phone']];
|
||||
|
||||
if (isset($search['carno']) && !empty($search['carno'])) {
|
||||
$search['carno'] = trim($search['carno']);
|
||||
$where[] = ['LIKE', 'car_no', $search['carno']];
|
||||
}
|
||||
if (isset($search['phone']) && !empty($search['phone'])) {
|
||||
$search['phone'] = trim($search['phone']);
|
||||
$where[] = ['=', 'from_mobile', $search['phone']];
|
||||
}
|
||||
|
||||
if (isset($search['city']) && !empty($search['city'])) {
|
||||
$search['city'] = trim($search['city']);
|
||||
$where[] = ['LIKE', 'aim_city', $search['city']];
|
||||
}
|
||||
|
||||
$search['employee'] = isset($search['employee']) ? (int)$search['employee'] : '';
|
||||
$EmployeeModel = new AcEmployee();
|
||||
if (!empty($search['employee'])) {
|
||||
$where[] = ['=', 'employee_id', $search['employee']];
|
||||
$employee = $EmployeeModel->findOne($search['employee']);
|
||||
$search['employee_title'] = isset($employee->name) ? $employee->name : '';
|
||||
}
|
||||
$search['store_id'] = isset($search['store_id']) ? (int)$search['store_id'] : '';
|
||||
if (empty($search['sotre_id'])) {
|
||||
$search['store_id'] = isset($get['store_id']) ? (int)$get['store_id'] : 0;
|
||||
}
|
||||
$StoreModel = new AcStore();
|
||||
if (!empty($search['store_id'])) {
|
||||
$where[] = ['=', 'store_id', $search['store_id']];
|
||||
$store = $StoreModel->findOne($search['store_id']);
|
||||
$search['store_title'] = isset($store->title) ? $store->title : '';
|
||||
}
|
||||
|
||||
$search['start_province'] = isset($search['start_province']) ? trim($search['start_province']) : '';
|
||||
if (!empty($search['start_province'])) {
|
||||
$where[] = ['=', 'start_province', $search['start_province']];
|
||||
}
|
||||
$search['start_city'] = isset($search['start_city']) ? trim($search['start_city']) : '';
|
||||
if (!empty($search['start_city'])) {
|
||||
$where[] = ['LIKE', 'start_city', $search['start_city']];
|
||||
}
|
||||
$search['aim_province'] = isset($search['aim_province']) ? trim($search['aim_province']) : '';
|
||||
if (!empty($search['aim_province'])) {
|
||||
$where[] = ['=', 'aim_province', $search['aim_province']];
|
||||
}
|
||||
$search['aim_city'] = isset($search['aim_city']) ? trim($search['aim_city']) : '';
|
||||
if (!empty($search['aim_city'])) {
|
||||
$where[] = ['LIKE', 'aim_city', $search['aim_city']];
|
||||
}
|
||||
|
||||
$search['bind'] = isset($search['bind']) ? trim($search['bind']) : '';
|
||||
if (!empty($search['bind'])) {
|
||||
$where[] = ['LIKE', 'bind', $search['bind']];
|
||||
}
|
||||
if (isset($search['status_code']) && $search['status_code'] != 'all') {
|
||||
$search['status_code'] = (int)$search['status_code'];
|
||||
$where[] = ['=', 'status_code', $search['status_code']];
|
||||
} else {
|
||||
unset($search['status_code']);
|
||||
}
|
||||
|
||||
$deleted = 0;
|
||||
$where[] = ['=', 'deleted', $deleted];
|
||||
|
||||
$page = $this->page;
|
||||
$pageSize = $this->pageSize;
|
||||
$data = $model->find()->where($where)->andwhere($orwhere);
|
||||
$pages = new Pagination(['totalCount' => $data->count(), 'pageSize' => $pageSize]);
|
||||
$pages->setPage($page - 1, TRUE); //设置分页的当前页面值
|
||||
$_orderby = 'update_at DESC,id DESC';
|
||||
$res = $data->offset($pages->offset)->limit($pages->limit)->orderby($_orderby)->all();
|
||||
return ['res' => $res, 'data' => $data];
|
||||
}
|
||||
|
||||
private function showOrder($orderRes, $data)
|
||||
{
|
||||
$status = Yii::$app->params['OrderPreStatus'];
|
||||
|
||||
$cids = $sids = $eids = $mids = [];
|
||||
if ($orderRes) {
|
||||
foreach ($orderRes as $r) {
|
||||
$sids[$r->store_id] = $r->store_id;
|
||||
$eids[$r->employee_id] = $r->employee_id;
|
||||
}
|
||||
}
|
||||
|
||||
$where = [];
|
||||
$where['pid'] = Yii::$app->session->get('pid');
|
||||
|
||||
$model = new AcStore();
|
||||
$_stores = $model->find()->where(['in', 'id', $sids])->all();
|
||||
$stores = [];
|
||||
foreach ($_stores as $s) {
|
||||
$stores[$s->id] = $s->toArray();
|
||||
}
|
||||
unset($s);
|
||||
|
||||
$model = new AcEmployee();
|
||||
$employees = [];
|
||||
$_employees = $model->find()->where(['in', 'id', $eids])->indexBy('id')->all();
|
||||
foreach ($_employees as $s) {
|
||||
$employees[$s->id] = $s->toArray();
|
||||
}
|
||||
unset($s);
|
||||
|
||||
$orders = [];
|
||||
$unsets = ['pid', 'create_at', 'deleted', 'from_mid', 'car'];
|
||||
|
||||
foreach ($orderRes as $s) {
|
||||
$s = $s->toArray();
|
||||
foreach ($unsets as $us) {
|
||||
unset($s[$us]);
|
||||
}
|
||||
$s['price'] = !empty($s['price']) ? $s['price'] : '尚未报价';
|
||||
|
||||
$weekdays = [0 => '日', 1 => '一', 2 => '二', 3 => '三', 4 => '四', 5 => '五', 6 => '六'];
|
||||
$wk = date('w', $s['date']);
|
||||
$s['date_plan'] = date('Y-m-d ', $s['date']) . '星期' . $weekdays[$wk];
|
||||
|
||||
$s['from_province'] = isset($s['start_province']) ? Yii::$app->params['regionAreas'][$s['start_province']] : '';
|
||||
$s['to_province'] = isset($s['aim_province']) ? Yii::$app->params['regionAreas'][$s['aim_province']] : '';
|
||||
|
||||
$s['status'] = $status[$s['status_code']];
|
||||
$orders[] = $s;
|
||||
}
|
||||
unset($s);
|
||||
|
||||
$return = [];
|
||||
$return['code'] = 200;
|
||||
$return['msg'] = '订单查询成功!';
|
||||
$return['data'] = [
|
||||
'total' => $data->count(),
|
||||
'orders' => $orders,
|
||||
'employees' => $employees,
|
||||
'stores' => $stores,
|
||||
'page' => $this->page
|
||||
];
|
||||
exit(json_encode($return, JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
|
||||
public function actionDetail()
|
||||
{
|
||||
$pid = $this->pid;
|
||||
$status = Yii::$app->params['OrderStatus'];
|
||||
$post = $this->postdata;
|
||||
|
||||
$id = isset($post['id']) ? $post['id'] : 0;
|
||||
if ($id <= 0) {
|
||||
$this->result('查询参数错误!');
|
||||
}
|
||||
$AcOrderPre = new AcOrderPre();
|
||||
$order = $AcOrderPre->findOne($id);
|
||||
$detail = $order->toArray();
|
||||
|
||||
if ($detail['store_id']) {
|
||||
$model = new AcStore();
|
||||
$store = $model->findOne($detail['store_id']);
|
||||
if ($store) {
|
||||
$detail['store_title'] = $store->title;
|
||||
}
|
||||
}
|
||||
|
||||
if ($detail['employee_id']) {
|
||||
$model = new AcEmployee();
|
||||
$employee = $model->findOne($detail['employee_id']);
|
||||
if ($employee) {
|
||||
$detail['employee_title'] = $employee->name;
|
||||
}
|
||||
}
|
||||
|
||||
$sn = '00000000000'; //11位
|
||||
$sn = substr($sn, 0, 11 - strlen($id));
|
||||
$sn .= $id;
|
||||
$detail['sn'] = $detail['sn'] ? $detail['sn'] : $sn;
|
||||
|
||||
$weekdays = [0 => '日', 1 => '一', 2 => '二', 3 => '三', 4 => '四', 5 => '五', 6 => '六'];
|
||||
$wk = date('w', $detail['date']);
|
||||
$detail['date_plan'] = date('Y-m-d 星期' . $weekdays[$wk], $detail['date']);
|
||||
$detail['remark'] = !empty($detail['remark']) ? htmlspecialchars_decode($detail['remark']) : '';
|
||||
$detail['car'] = !empty($detail['car']) ? htmlspecialchars_decode($detail['car']) : '';
|
||||
|
||||
$unsets = ['create_at', 'deleted', 'from_mid'];
|
||||
foreach ($unsets as $us) {
|
||||
unset($detail[$us]);
|
||||
}
|
||||
$this->result('查询成功!', $detail, 200);
|
||||
}
|
||||
|
||||
public function actionCancel()
|
||||
{
|
||||
$pid = $this->pid;
|
||||
$status = Yii::$app->params['OrderStatus'];
|
||||
$post = $this->postdata;
|
||||
|
||||
$id = isset($post['id']) ? $post['id'] : 0;
|
||||
if ($id <= 0) {
|
||||
$this->result('未指定订单!');
|
||||
}
|
||||
$AcOrderPre = new AcOrderPre();
|
||||
$order = $AcOrderPre->findOne($id);
|
||||
if ($order->from_uid != $this->user_id) {
|
||||
$this->result('非本人订单,不允许操作!');
|
||||
}
|
||||
if ($order->status_code <= 0 || $order->status_code >= 99) {
|
||||
$this->result('订单已取消或已经完成,不允许操作!');
|
||||
}
|
||||
$order->status_code = -1;
|
||||
$order->save();
|
||||
$this->result('已取消!', $order->toArray(), 200);
|
||||
}
|
||||
|
||||
public function actionCreate()
|
||||
{
|
||||
/**
|
||||
* 创建咨询单
|
||||
* @mid [int] 平台租户身份
|
||||
* @uid [int] 前端用户身份
|
||||
*/
|
||||
$get = Yii::$app->request->get();
|
||||
$post = $this->postdata;
|
||||
$pid = $this->pid;
|
||||
|
||||
//格式化数据 为空的项则不修改
|
||||
$data['from_uid'] = $this->user_id;
|
||||
//目标键=》POST键
|
||||
$cols = ['start_province' => 'start_province', 'start_city' => 'start_city', 'aim_province' => 'aim_province', 'aim_city' => 'aim_city',
|
||||
'car_title' => 'car_title', 'car_no' => 'car_no', 'price' => 'price',
|
||||
'bind' => 'bind', 'receptionist' => "receptionist",
|
||||
'from_name' => 'from_name', 'from_mobile' => 'from_mobile',
|
||||
];
|
||||
foreach ($cols as $col => $key) {
|
||||
if (isset($post[$key]) && $post[$key] != '') {
|
||||
$data[$col] = trim($post[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
$cols = ['car_value' => 'car_value', 'from_gender' => 'from_gender'];
|
||||
foreach ($cols as $col => $key) {
|
||||
$data[$col] = 0;
|
||||
if (isset($post[$key]) && $post[$key] != '') {
|
||||
$data[$col] = (int)$post[$key];
|
||||
}
|
||||
}
|
||||
|
||||
$cols = ['remark' => 'remark', 'car' => 'car'];
|
||||
foreach ($cols as $col => $key) {
|
||||
if (isset($post[$key]) && $post[$key] != '') {
|
||||
$data[$col] = htmlspecialchars($post[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
/*@date: 1649952000000*/
|
||||
$data['date'] = isset($post['plan_date']) ? $post['plan_date'] / 1000 : strtotime('+7 day');
|
||||
// 计划时间,默认7天后
|
||||
|
||||
$mid = isset($post['mid']) ? (int)$post['mid'] : 0;
|
||||
$data['from_mid'] = $mid;
|
||||
|
||||
$data['status_code'] = 1; //订单处于创建待审核状态
|
||||
|
||||
$data['create_at'] = time();
|
||||
$data['update_at'] = $data['create_at'];
|
||||
$data['pid'] = $pid;
|
||||
|
||||
$data['employee_id'] = isset($post['employee_id']) ? (int)$post['employee_id'] : 0;
|
||||
$data['store_id'] = isset($post['store_id']) ? (int)$post['store_id'] : 0;
|
||||
|
||||
//保存资料
|
||||
$AcOrderPre = new AcOrderPre();
|
||||
foreach ($data as $key => $val) {
|
||||
$AcOrderPre->$key = $val;
|
||||
}
|
||||
|
||||
$res = $AcOrderPre->save();
|
||||
$id = $AcOrderPre->attributes['id']; //获取插入后id
|
||||
|
||||
if ($res) {
|
||||
$this->result('询单保存成功!', ['id' => $id], 200);
|
||||
} else {
|
||||
$this->result('询单保存失败!', [], 100);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
订单数据显示格式化
|
||||
*/
|
||||
|
||||
public function actionEdit()
|
||||
{
|
||||
/**
|
||||
* 更新咨询单
|
||||
* @mid [int] 平台租户身份
|
||||
* @uid [int] 前端用户身份
|
||||
*/
|
||||
$get = Yii::$app->request->get();
|
||||
$post = $this->postdata;
|
||||
$id = isset($post['id']) ? (int)$post['id'] : 0;
|
||||
if (!$id) {
|
||||
$this->result('未指定询价单!');
|
||||
}
|
||||
$model = new AcOrderPre();
|
||||
$detail = $model->findOne($id);
|
||||
if (!$detail) {
|
||||
$this->result('询价单信息不存在!');
|
||||
}
|
||||
if ($detail->pid != $this->pid) {
|
||||
$this->result('非法操作!');
|
||||
}
|
||||
if ($detail->from_uid != $this->user_id) {
|
||||
$this->result('非法操作,请检查订单归属!');
|
||||
}
|
||||
|
||||
//格式化数据 为空的项则不修改
|
||||
|
||||
//目标键=》POST键
|
||||
$cols = ['start_province' => 'start_province', 'start_city' => 'start_city', 'aim_province' => 'aim_province', 'aim_city' => 'aim_city',
|
||||
'car_title' => 'car_title', 'car_no' => 'car_no',
|
||||
'from_name' => 'from_name', 'from_mobile' => 'from_mobile',
|
||||
];
|
||||
foreach ($cols as $col => $key) {
|
||||
if (isset($post[$key]) && $post[$key] != '') {
|
||||
$detail->$col = trim($post[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
$cols = ['car_value' => 'car_value', 'from_gender' => 'from_gender'];
|
||||
foreach ($cols as $col => $key) {
|
||||
if (isset($post[$key]) && $post[$key] != '') {
|
||||
$detail->$col = (int)$post[$key];
|
||||
}
|
||||
}
|
||||
|
||||
$cols = ['remark' => 'remark'];
|
||||
foreach ($cols as $col => $key) {
|
||||
if (isset($post[$key]) && $post[$key] != '') {
|
||||
$detail->$col = htmlspecialchars($post[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
$detail->date = isset($post['plan_date']) ? $post['plan_date'] / 1000 : $detail->date;
|
||||
|
||||
$detail->status_code = 1; //标记订单处于创建待审核状态
|
||||
$detail->update_at = time();
|
||||
|
||||
//保存资料
|
||||
$res = $detail->save();
|
||||
|
||||
if ($res) {
|
||||
$this->result('询单保存成功!', ['id' => $id], 200);
|
||||
} else {
|
||||
$this->result('询单保存失败!', [], 100);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,362 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-05-22T07:38:52+08:00
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-08-09T08:53:58+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
|
||||
namespace api\controllers\client\v1;
|
||||
|
||||
use Yii;
|
||||
use vendor\aliyun\dysms\Sms;
|
||||
use common\models\CSms;
|
||||
use common\models\CVcode;
|
||||
use addons\models\AcPlat;
|
||||
|
||||
class SmsController extends Common
|
||||
{
|
||||
public function beforeAction($action)
|
||||
{
|
||||
if (!$this->pid) {
|
||||
$this->result('您正使用本系统内部接口,禁止非法链接使用!');
|
||||
}
|
||||
return parent::beforeAction($action);
|
||||
}
|
||||
|
||||
public function actionIndex()
|
||||
{
|
||||
$apis = [
|
||||
'vcode' => '获取短信验证码'
|
||||
];
|
||||
$this->result('您正使用CMTS-CLIENT系统短信管理接口!', $apis, 200);
|
||||
}
|
||||
|
||||
public function actionSend()
|
||||
{
|
||||
global $START_TIME;
|
||||
|
||||
$session = Yii::$app->session;
|
||||
|
||||
//数据取出方法
|
||||
$dataPost = Yii::$app->request->post(); //YII应用内的真实或模拟POST数据
|
||||
$dataGet = Yii::$app->request->get(); //YII应用内的真实或模拟GET数据
|
||||
$params = Yii::$app->params;
|
||||
|
||||
$config = array();
|
||||
$config['accessKeyId'] = isset($dataPost['accessKeyId']) ? $dataPost['accessKeyId'] : $params['aliDySms']['accessKeyId'];
|
||||
$config['accessKeySecret'] = isset($dataPost['accessKeySecret']) ? $dataPost['accessKeySecret'] : $params['aliDySms']['accessKeySecret'];
|
||||
$config['sign'] = isset($dataPost['sign']) ? $dataPost['sign'] : $params['aliDySms']['sign'];
|
||||
if ($config) {
|
||||
$session->set('sms::config', $config);
|
||||
} else {
|
||||
$config = $session->get('sms::config');
|
||||
}
|
||||
|
||||
$option = array();
|
||||
$sms = new Sms($option, $config);
|
||||
|
||||
$address = isset($dataPost['address']) ? $dataPost['address'] : '';
|
||||
if ($address) {
|
||||
$session->set('sms::address', $address);
|
||||
} else {
|
||||
$address = $session->get('sms::address');
|
||||
}
|
||||
|
||||
$tmpl = isset($dataPost['tmpl']) ? $dataPost['tmpl'] : '';
|
||||
if ($tmpl) {
|
||||
$session->set('sms::tmpl', $tmpl);
|
||||
} else {
|
||||
$tmpl = $session->get('sms::tmpl');
|
||||
}
|
||||
|
||||
$_guests = isset($dataPost['guests']) ? $dataPost['guests'] : '';
|
||||
if (!$_guests) {
|
||||
$guests = $session->get('sms::guests');
|
||||
} else {
|
||||
$_guests = explode("\r\n", $_guests);
|
||||
$guests = array();
|
||||
foreach ($_guests as $c) {
|
||||
$_c = explode(',', $c);
|
||||
if (count($_c) > 1) {
|
||||
$k = trim($_c[1]);
|
||||
$v = trim($_c[0]);
|
||||
$guests[$k] = $v;
|
||||
}
|
||||
}
|
||||
unset($_c);
|
||||
unset($k);
|
||||
unset($v);
|
||||
$guests = array_unique($guests);
|
||||
}
|
||||
|
||||
if (!$guests) {
|
||||
$i = (int)$session->get('sms::success');
|
||||
$session->set('sms::success', 0);
|
||||
$msg = $session->get('sms::msg');
|
||||
$session->set('sms::msg', '');
|
||||
$this->result('群发完成,共成功发送' . $i . '条;详情:' . $msg);
|
||||
}
|
||||
|
||||
$results = [];
|
||||
$msg = "";
|
||||
$content = [];
|
||||
$content['address'] = $address;
|
||||
$i = 0;
|
||||
$j = 50;
|
||||
|
||||
foreach ($guests as $p => $username) {
|
||||
$j--;
|
||||
$content['name'] = !empty($username) ? $username . '安诚托车' : '安诚捷顺运车';
|
||||
$result = $sms->send($p, $tmpl, $content);
|
||||
$results[$p] = $result;
|
||||
|
||||
if (!$result) {
|
||||
$msg .= "【" . $p . "】发送失败,接口提示:" . $sms->errors . "\r\n";
|
||||
} else if ($result->Code != 'OK') {
|
||||
$msg .= "【" . $p . "】发送失败,接口提示:" . $result->Message . "\r\n";
|
||||
} else {
|
||||
$i++;
|
||||
$msg .= "【" . $p . "】发送成功";
|
||||
}
|
||||
unset($guests[$p]);
|
||||
if ($j == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
$session->set('sms::guests', $guests);
|
||||
|
||||
$i += (int)$session->get('sms::success');
|
||||
$session->set('sms::success', $i);
|
||||
$msg .= $session->get('sms::msg');
|
||||
$session->set('sms::msg', $msg);
|
||||
$this->result('群发完成,共成功发送' . $i . '条;详情:' . $msg);
|
||||
}
|
||||
|
||||
//发送验证码
|
||||
public function actionVcode()
|
||||
{
|
||||
$pid = $this->pid;
|
||||
$plat = AcPlat::findOne($pid);
|
||||
$platExt = json_decode($plat->remark, TRUE);
|
||||
|
||||
//数据取出方法
|
||||
$dataPost = $this->postdata; //YII应用内的真实或模拟POST数据
|
||||
$phone = $dataPost['phone'] ?? 0;
|
||||
//验证手机号
|
||||
$isPhone = FALSE;
|
||||
if ($phone) {
|
||||
$isPhone = preg_match('/^1\d{10}$/', $phone) ? TRUE : FALSE;
|
||||
}
|
||||
if (!$isPhone) {
|
||||
$this->result('手机号不正确,请确认');
|
||||
}
|
||||
// 手机号掩码
|
||||
$phoneMask = substr($phone, 0, 3) . str_repeat('*', strlen($phone) - 7) . substr($phone, -4);
|
||||
|
||||
$params = Yii::$app->params;
|
||||
$codetype = $dataPost['scence'] ?? 'vcode'; //验证码使用场景
|
||||
|
||||
$config = array();
|
||||
$config['accessKeyId'] = isset($dataPost['accessKeyId']) ? $dataPost['accessKeyId'] : $params['aliDySms']['accessKeyId'];
|
||||
$config['accessKeySecret'] = isset($dataPost['accessKeySecret']) ? $dataPost['accessKeySecret'] : $params['aliDySms']['accessKeySecret'];
|
||||
$config['sign'] = isset($dataPost['sign']) ? $dataPost['sign'] : $params['aliDySms']['sign'];
|
||||
|
||||
$option = array();
|
||||
$sms = new Sms($option, $config);
|
||||
$_time = time();
|
||||
$vcodeModel = new CVcode();
|
||||
//查询上次发送记录
|
||||
$where = [];
|
||||
$where['mobile'] = $phone;
|
||||
$where['deleted'] = 0;
|
||||
$where['type'] = $codetype;
|
||||
$res = $vcodeModel->find()->where($where)->one();
|
||||
if ($res) {
|
||||
if (($_time - $res->create_at) < 300) {
|
||||
//设置5分钟内,验证码仍然可用
|
||||
$code = $res->code;
|
||||
$msg = '上次发送的验证码仍然可用;请注意查看手机 ' . $phoneMask;
|
||||
$data = ['errorcode' => 2];
|
||||
if (YII_DEBUG) {
|
||||
$data['code'] = $code;
|
||||
}
|
||||
$this->result($msg, $data, 200);
|
||||
} else {
|
||||
$res->deleted = 1;
|
||||
$res->save();
|
||||
}
|
||||
}
|
||||
|
||||
$content = [];
|
||||
$code = mt_rand(1000, 9999);
|
||||
$content['code'] = $code;
|
||||
|
||||
//验证码准备入库
|
||||
$vcode = [];
|
||||
$vcode['code'] = $code;
|
||||
$vcode['type'] = $codetype;
|
||||
$vcode['mobile'] = $phone;
|
||||
$vcode['create_at'] = $_time;
|
||||
foreach ($vcode as $key => $val) {
|
||||
$vcodeModel->$key = $val;
|
||||
}
|
||||
$tmpls = $params['aliDySms']['tmpl'];
|
||||
switch ($codetype) {
|
||||
case 'reg':
|
||||
$tmpl = $tmpls['regVerify'];
|
||||
break;
|
||||
case 'login':
|
||||
$tmpl = $tmpls['loginVcode'];
|
||||
break;
|
||||
case 'info':
|
||||
$tmpl = $tmpls['infoChange'];
|
||||
break;
|
||||
case 'passwd':
|
||||
$tmpl = $tmpls['passwdChange'];
|
||||
break;
|
||||
case 'vcode':
|
||||
default:
|
||||
$tmpl = $tmpls['vcode'];
|
||||
break;
|
||||
}
|
||||
|
||||
// 发送前控制
|
||||
$host = yii::$app->request->hostName;
|
||||
$debug = $params['aliDySms']['debug'] ?? FALSE;
|
||||
$domains = $params['aliDySms']['domains'] ?? [];
|
||||
$sendable = FALSE;
|
||||
if (in_array($host, $domains) || $debug) {
|
||||
$sendable = TRUE;
|
||||
}
|
||||
$result = TRUE;
|
||||
if ($sendable) {
|
||||
$result = $sms->send($phone, $tmpl, $content);
|
||||
}
|
||||
|
||||
//保存发送记录
|
||||
$smsModel = new CSms();
|
||||
$smsdata = [];
|
||||
$sid = $params['siteId'];
|
||||
$smsdata['sid'] = (int)$sid;
|
||||
$smsdata['pid'] = $pid;
|
||||
$smsdata['uid'] = 0;
|
||||
$smsdata['mid'] = $this->user_id;
|
||||
$smsdata['mobile'] = $phone;
|
||||
$smsdata['content'] = json_encode($content, JSON_UNESCAPED_UNICODE);
|
||||
$smsdata['create_at'] = $_time;
|
||||
foreach ($smsdata as $key => $val) {
|
||||
$smsModel->$key = $val;
|
||||
}
|
||||
$smsModel->save();
|
||||
|
||||
$errorcode = 0;
|
||||
$msg = '';
|
||||
if (!$result) {
|
||||
$msg .= "发送失败,接口提示:" . $sms->errors;
|
||||
$errorcode = 3;
|
||||
} else if (is_array($result) && $result['Code'] != 'OK') {
|
||||
$msg .= "发送失败,接口提示:" . $result['Message'];
|
||||
$errorcode = 4;
|
||||
} else {
|
||||
$vcodeModel->save();
|
||||
$msg .= "发送成功";
|
||||
}
|
||||
$data = ['errorcode' => $errorcode];
|
||||
if (!$debug || YII_DEBUG) {
|
||||
$data['data'] = $content;
|
||||
}
|
||||
$this->result($msg, $data, 200);
|
||||
}
|
||||
|
||||
//发送给财务
|
||||
public function actionCaiwu()
|
||||
{
|
||||
$pid = $this->pid;
|
||||
$plat = AcPlat::findOne($pid);
|
||||
$platExt = json_decode($plat->remark, TRUE);
|
||||
|
||||
$phone = $platExt['cw_phone'];
|
||||
if (!$phone) {
|
||||
$this->result('还没有配置财务手机号,请联系站长管理员进行设置!', ['errorcode' => 1], 200);
|
||||
}
|
||||
|
||||
$vcodeModel = new CVcode();
|
||||
$codetype = 'caiwu';
|
||||
//查询上次发送记录
|
||||
$_time = time();
|
||||
$where = [];
|
||||
$where['mobile'] = $phone;
|
||||
$where['deleted'] = 0;
|
||||
$where['type'] = $codetype;
|
||||
$res = $vcodeModel->find()->where($where)->one();
|
||||
if ($res) {
|
||||
if (($_time - $res->create_at) < 7200) {
|
||||
//设置2小时内,验证码仍然可用
|
||||
$code = $res->code;
|
||||
$this->result('上次发送的验证码仍然可用;请注意查看财务手机!', ['errorcode' => 2], 200);
|
||||
} else {
|
||||
$res->deleted = 1;
|
||||
$res->save();
|
||||
}
|
||||
}
|
||||
|
||||
//数据取出方法
|
||||
$dataPost = $this->postdata; //YII应用内的真实或模拟POST数据
|
||||
$params = Yii::$app->params;
|
||||
|
||||
$content = [];
|
||||
$code = mt_rand(1000, 9999);
|
||||
$content['code'] = $code;
|
||||
$tmpl = $params['aliDySms']['tmpl']['cwVcode'];
|
||||
|
||||
//验证码准备入库
|
||||
$vcode = [];
|
||||
$vcode['code'] = $code;
|
||||
$vcode['type'] = $codetype;
|
||||
$vcode['mobile'] = $phone;
|
||||
$vcode['create_at'] = $_time;
|
||||
foreach ($vcode as $key => $val) {
|
||||
$vcodeModel->$key = $val;
|
||||
}
|
||||
|
||||
$config = array();
|
||||
$config['accessKeyId'] = isset($dataPost['accessKeyId']) ? $dataPost['accessKeyId'] : $params['aliDySms']['accessKeyId'];
|
||||
$config['accessKeySecret'] = isset($dataPost['accessKeySecret']) ? $dataPost['accessKeySecret'] : $params['aliDySms']['accessKeySecret'];
|
||||
$config['sign'] = isset($dataPost['sign']) ? $dataPost['sign'] : $params['aliDySms']['sign'];
|
||||
|
||||
$option = array();
|
||||
$sms = new Sms($option, $config);
|
||||
$result = $sms->send($phone, $tmpl, $content); //编排发送短信
|
||||
//保存发送记录
|
||||
$smsModel = new CSms();
|
||||
$smsdata = [];
|
||||
$sid = $params['siteId'];
|
||||
$smsdata['sid'] = (int)$sid;
|
||||
$smsdata['pid'] = $pid;
|
||||
$smsdata['uid'] = 0;
|
||||
$smsdata['mid'] = $this->user_id;
|
||||
$smsdata['mobile'] = $phone;
|
||||
$smsdata['content'] = json_encode($content, JSON_UNESCAPED_UNICODE);
|
||||
$smsdata['create_at'] = $_time;
|
||||
foreach ($smsdata as $key => $val) {
|
||||
$smsModel->$key = $val;
|
||||
}
|
||||
$smsModel->save();
|
||||
|
||||
$errorcode = 0;
|
||||
$msg = '';
|
||||
if (!$result) {
|
||||
$msg .= "发送失败,接口提示:" . $sms->errors;
|
||||
$errorcode = 3;
|
||||
} else if (is_array($result) && $result['Code'] != 'OK') {
|
||||
$msg .= "发送失败,接口提示:" . $result['Message'];
|
||||
$errorcode = 4;
|
||||
} else {
|
||||
$vcodeModel->save();
|
||||
$msg .= "发送成功";
|
||||
}
|
||||
$this->result($msg, ['errorcode' => $errorcode], 200);
|
||||
}
|
||||
}
|
@ -1,107 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客(三亚) <fm453>
|
||||
# @Date: 2022-04-15 20:22:03
|
||||
# @Email: fm453@lukegzs.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-08-09T09:20:31+08:00
|
||||
# @Copyright: www.hiluker.cn
|
||||
//DataApi站点用户专入口
|
||||
|
||||
namespace api\controllers\client\v1;
|
||||
|
||||
use Yii;
|
||||
use yii\helpers\Url;
|
||||
use common\models\User;
|
||||
|
||||
class UserController extends Common
|
||||
{
|
||||
public function beforeAction($action)
|
||||
{
|
||||
if (!$this->pid) {
|
||||
$this->result('您正使用本系统内部接口,禁止非法链接使用!');
|
||||
}
|
||||
return parent::beforeAction($action);
|
||||
}
|
||||
|
||||
public function actionIndex()
|
||||
{
|
||||
$apis = [
|
||||
'login' => '登陆'
|
||||
];
|
||||
$this->result('您正使用DACMS系统用户管理接口!', $apis, 200);
|
||||
}
|
||||
|
||||
public function actionLogin()
|
||||
{
|
||||
$pid = $this->pid;
|
||||
$post = $this->postdata;
|
||||
$search = $post['search'] ?? NULL;
|
||||
|
||||
$username = $search['username'] ?? NULL;
|
||||
$username = $post['username'] ?? $username;
|
||||
|
||||
$passwd = $search['passwd'] ?? NULL;
|
||||
$passwd = $post['passwd'] ?? $passwd;
|
||||
|
||||
$return = [];
|
||||
if (!$username && !$passwd) {
|
||||
$this->result('登陆参数错误!', NULL, 400);
|
||||
}
|
||||
if (!$username) {
|
||||
$this->result('请输入您的账号!', NULL, 400);
|
||||
}
|
||||
if (!$passwd) {
|
||||
$this->result('请输入您的密码!', NULL, 400);
|
||||
}
|
||||
$username = trim(htmlspecialchars_decode($username));
|
||||
$passwd = trim(htmlspecialchars_decode($passwd));
|
||||
if (!$username) {
|
||||
$this->result('输入错误,请检查您的账号!', NULL, 400);
|
||||
}
|
||||
if (!$passwd) {
|
||||
$this->result('输入有误,请检查您的密码!', NULL, 400);
|
||||
}
|
||||
|
||||
$model = new User();
|
||||
$user = $model->findOne(['mobile' => $username]);
|
||||
if (!$user) {
|
||||
$this->result('查无此人!', NULL, 404);
|
||||
}
|
||||
|
||||
if ($user->status != User::STATUS_ACTIVE) {
|
||||
$this->result('账户异常,禁止登陆!', NULL, 403);
|
||||
}
|
||||
//安全校验,登陆密码
|
||||
$isPwdRight = $user->validatePassword($passwd);
|
||||
|
||||
if (!$isPwdRight) {
|
||||
$this->result('密码错误,禁止登陆!', NULL, 400);
|
||||
}
|
||||
//用户主信息校验结束
|
||||
|
||||
$_user = $this->userLogin($user, TRUE);
|
||||
$this->result('登陆成功!', ['user' => $_user], 200);
|
||||
}
|
||||
|
||||
private function userLogin($user, $hasExt = FALSE)
|
||||
{
|
||||
// 使用指定用户名获取用户身份实例
|
||||
$identity = $user;
|
||||
// 登录用户,有效期30d
|
||||
$duration = 3600 * 24 * 30;
|
||||
$_login = Yii::$app->user->login($identity, $duration);
|
||||
if (!$_login) {
|
||||
$this->result('登陆失败!', NULL, 400);
|
||||
}
|
||||
//登陆成功,返回用户信息
|
||||
$_user = ['id' => $user->id, 'username' => $user->username, 'mobile' => $user->mobile, 'email' => $user->email, 'avatar' => Url::to($user->avatar)];
|
||||
$_user['employee_id'] = $this->employee_id;
|
||||
|
||||
//生成token(用户数据,是否强制更新,过期时间
|
||||
$isLong = $this->postdata['isLong'] ?? FALSE;
|
||||
$expire = $isLong ? '+1 Month' : FALSE;
|
||||
$_user = $this->userToken($_user, $refresh = TRUE, $expire);
|
||||
return $_user;
|
||||
}
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>恭喜,站点创建成功!</title>
|
||||
<style>
|
||||
.container {
|
||||
width: 60%;
|
||||
margin: 10% auto 0;
|
||||
background-color: #f0f0f0;
|
||||
padding: 2% 5%;
|
||||
border-radius: 10px
|
||||
}
|
||||
|
||||
ul {
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
ul li {
|
||||
line-height: 2.3
|
||||
}
|
||||
|
||||
a {
|
||||
color: #20a53a
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>恭喜, 站点创建成功!</h1>
|
||||
<h3>这是默认index.html,本页面由系统自动生成</h3>
|
||||
<ul>
|
||||
<li>本页面在FTP根目录下的index.html</li>
|
||||
<li>您可以修改、删除或覆盖本页面</li>
|
||||
<li>FTP相关信息,请到“面板系统后台 > FTP” 查看</li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,8 +0,0 @@
|
||||
@Author: 嗨噜客(三亚) <fm453>
|
||||
@Date: 2024-07-06T09:30:10+08:00
|
||||
@Email: 393213759@qq.com
|
||||
@Last modified by: fm453
|
||||
@Last modified time: 2024-07-06T09:30:10+08:00
|
||||
@Copyright: www.hiluker.cn
|
||||
|
||||
轿车托运物流管理系统后台API
|
File diff suppressed because it is too large
Load Diff
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', true);
|
||||
defined('YII_ENV') or define('YII_ENV', 'test');
|
||||
defined('YII_APP_BASE_PATH') or define('YII_APP_BASE_PATH', __DIR__.'/../../');
|
||||
|
||||
require_once(YII_APP_BASE_PATH . '/vendor/autoload.php');
|
||||
require_once(YII_APP_BASE_PATH . '/vendor/yiisoft/yii2/Yii.php');
|
||||
require_once(YII_APP_BASE_PATH . '/common/config/bootstrap.php');
|
||||
require_once(__DIR__ . '/../config/bootstrap.php');
|
0
dacms-api/tests/_data/.gitignore
vendored
0
dacms-api/tests/_data/.gitignore
vendored
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
return [
|
||||
[
|
||||
'username' => 'erau',
|
||||
'auth_key' => 'tUu1qHcde0diwUol3xeI-18MuHkkprQI',
|
||||
// password_0
|
||||
'password_hash' => '$2y$13$nJ1WDlBaGcbCdbNC5.5l4.sgy.OMEKCqtDQOdQ2OWpgiKRWYyzzne',
|
||||
'password_reset_token' => 'RkD_Jw0_8HEedzLk7MM-ZKEFfYR7VbMr_1392559490',
|
||||
'created_at' => '1392559490',
|
||||
'updated_at' => '1392559490',
|
||||
'email' => 'sfriesen@jenkins.info',
|
||||
],
|
||||
];
|
2
dacms-api/tests/_output/.gitignore
vendored
2
dacms-api/tests/_output/.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
*
|
||||
!.gitignore
|
1
dacms-api/tests/_support/.gitignore
vendored
1
dacms-api/tests/_support/.gitignore
vendored
@ -1 +0,0 @@
|
||||
_generated
|
@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace backend\tests;
|
||||
|
||||
/**
|
||||
* Inherited Methods
|
||||
* @method void wantToTest($text)
|
||||
* @method void wantTo($text)
|
||||
* @method void execute($callable)
|
||||
* @method void expectTo($prediction)
|
||||
* @method void expect($prediction)
|
||||
* @method void amGoingTo($argumentation)
|
||||
* @method void am($role)
|
||||
* @method void lookForwardTo($achieveValue)
|
||||
* @method void comment($description)
|
||||
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
|
||||
*
|
||||
* @SuppressWarnings(PHPMD)
|
||||
*/
|
||||
class FunctionalTester extends \Codeception\Actor
|
||||
{
|
||||
use _generated\FunctionalTesterActions;
|
||||
|
||||
/**
|
||||
* Define custom actions here
|
||||
*/
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace backend\tests;
|
||||
|
||||
/**
|
||||
* Inherited Methods
|
||||
* @method void wantToTest($text)
|
||||
* @method void wantTo($text)
|
||||
* @method void execute($callable)
|
||||
* @method void expectTo($prediction)
|
||||
* @method void expect($prediction)
|
||||
* @method void amGoingTo($argumentation)
|
||||
* @method void am($role)
|
||||
* @method void lookForwardTo($achieveValue)
|
||||
* @method void comment($description)
|
||||
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
|
||||
*
|
||||
* @SuppressWarnings(PHPMD)
|
||||
*/
|
||||
class UnitTester extends \Codeception\Actor
|
||||
{
|
||||
use _generated\UnitTesterActions;
|
||||
/**
|
||||
* Define custom actions here
|
||||
*/
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
class_name: FunctionalTester
|
||||
modules:
|
||||
enabled:
|
||||
- Yii2
|
@ -1,37 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace backend\tests\functional;
|
||||
|
||||
use \backend\tests\FunctionalTester;
|
||||
use common\fixtures\User as UserFixture;
|
||||
|
||||
/**
|
||||
* Class LoginCest
|
||||
*/
|
||||
class LoginCest
|
||||
{
|
||||
public function _before(FunctionalTester $I)
|
||||
{
|
||||
$I->haveFixtures([
|
||||
'user' => [
|
||||
'class' => UserFixture::className(),
|
||||
'dataFile' => codecept_data_dir() . 'login_data.php'
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FunctionalTester $I
|
||||
*/
|
||||
public function loginUser(FunctionalTester $I)
|
||||
{
|
||||
$I->amOnPage('/site/login');
|
||||
$I->fillField('Username', 'erau');
|
||||
$I->fillField('Password', 'password_0');
|
||||
$I->click('login-button');
|
||||
|
||||
$I->see('Logout (erau)', 'form button[type=submit]');
|
||||
$I->dontSeeLink('Login');
|
||||
$I->dontSeeLink('Signup');
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Here you can initialize variables via \Codeception\Util\Fixtures class
|
||||
* to store data in global array and use it in Cests.
|
||||
*
|
||||
* ```php
|
||||
* // Here _bootstrap.php
|
||||
* \Codeception\Util\Fixtures::add('user1', ['name' => 'davert']);
|
||||
* ```
|
||||
*
|
||||
* In Cests
|
||||
*
|
||||
* ```php
|
||||
* \Codeception\Util\Fixtures::get('user1');
|
||||
* ```
|
||||
*/
|
@ -1 +0,0 @@
|
||||
class_name: UnitTester
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Here you can initialize variables via \Codeception\Util\Fixtures class
|
||||
* to store data in global array and use it in Tests.
|
||||
*
|
||||
* ```php
|
||||
* // Here _bootstrap.php
|
||||
* \Codeception\Util\Fixtures::add('user1', ['name' => 'davert']);
|
||||
* ```
|
||||
*
|
||||
* In Tests
|
||||
*
|
||||
* ```php
|
||||
* \Codeception\Util\Fixtures::get('user1');
|
||||
* ```
|
||||
*/
|
@ -1,6 +0,0 @@
|
||||
Options +FollowSymLinks
|
||||
IndexIgnore /
|
||||
RewriteEngine on
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule . index.php
|
@ -1 +0,0 @@
|
||||
MTWO07hqoQjRePhb5wX98mGDKL5YfstR
|
Binary file not shown.
Before Width: | Height: | Size: 66 KiB |
@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客科技(www.hiluker.cn) <fm453>
|
||||
# @Date: 1970-01-01T08:00:00+08:00
|
||||
# @Email: fm453@hiluker.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-07-12T15:26:54+08:00
|
||||
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', FALSE);
|
||||
defined('YII_ENV') or define('YII_ENV', 'prod');
|
||||
date_default_timezone_set('PRC'); //设置时区为中国
|
||||
define('TIMESTAMP', time());
|
||||
define('HI_APP', 'dacms'); //给子项目设置的统一短标识
|
||||
//跨域设置
|
||||
require(__DIR__ . '/../../addons-' . HI_APP . '/access.php');
|
||||
require(__DIR__ . '/../../cors.php');
|
||||
setheader();
|
||||
|
||||
require(__DIR__ . '/../../version.php');
|
||||
//YII框架初始化
|
||||
require(__DIR__ . '/../../vendor/autoload.php');
|
||||
require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php');
|
||||
require(__DIR__ . '/../../common/config/bootstrap.php');
|
||||
require(__DIR__ . '/../config/bootstrap.php');
|
||||
require(__DIR__ . '/../../upload-' . HI_APP . '/index.php');
|
||||
require(__DIR__ . '/../../addons-' . HI_APP . '/index.php');
|
||||
|
||||
// define('YII_APP', '/../../'.HI_APP.'-api');
|
||||
|
||||
$config = yii\helpers\ArrayHelper::merge(
|
||||
require(__DIR__ . '/../../common/config/main.php'),
|
||||
require(__DIR__ . '/../config/main.php'),
|
||||
require(__DIR__ . '/../../addons-' . HI_APP . '/config/db.php')
|
||||
);
|
||||
|
||||
$application = new yii\web\Application($config);
|
||||
$application->init();
|
||||
$application->run();
|
@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
# @Author: 嗨噜客科技(www.hiluker.cn) <fm453>
|
||||
# @Date: 1970-01-01T08:00:00+08:00
|
||||
# @Email: fm453@hiluker.com
|
||||
# @Last modified by: fm453
|
||||
# @Last modified time: 2024-07-01T14:44:59+08:00
|
||||
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', TRUE);
|
||||
defined('YII_ENV') or define('YII_ENV', 'dev');
|
||||
date_default_timezone_set('PRC'); //设置时区为中国
|
||||
define('TIMESTAMP', time());
|
||||
define('HI_APP', 'dacms'); //给子项目设置的统一短标识
|
||||
//跨域设置
|
||||
require(__DIR__ . '/../../addons-' . HI_APP . '/access.php');
|
||||
require(__DIR__ . '/../../cors.php');
|
||||
setheader();
|
||||
|
||||
require(__DIR__ . '/../../version.php');
|
||||
//YII框架初始化
|
||||
require(__DIR__ . '/../../vendor/autoload.php');
|
||||
require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php');
|
||||
require(__DIR__ . '/../../common/config/bootstrap.php');
|
||||
require(__DIR__ . '/../config/bootstrap.php');
|
||||
require(__DIR__ . '/../../upload-' . HI_APP . '/index.php');
|
||||
require(__DIR__ . '/../../addons-' . HI_APP . '/index.php');
|
||||
|
||||
// define('YII_APP', '/../../'.HI_APP.'-api');
|
||||
|
||||
$config = yii\helpers\ArrayHelper::merge(
|
||||
require(__DIR__ . '/../../common/config/main-local.php'),
|
||||
require(__DIR__ . '/../config/main-local.php'),
|
||||
require(__DIR__ . '/../../addons-' . HI_APP . '/config/db-local.php')
|
||||
);
|
||||
|
||||
$application = new yii\web\Application($config);
|
||||
$application->init();
|
||||
$application->run();
|
@ -1,2 +0,0 @@
|
||||
User-agent: *
|
||||
Disallow: /
|
@ -1,59 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace backend\widgets\common;
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\LinkPager;
|
||||
|
||||
class LinkPages extends LinkPager
|
||||
{
|
||||
/**
|
||||
* Renders the page buttons.
|
||||
* @return string the rendering result
|
||||
*/
|
||||
protected function renderPageButtons()
|
||||
{
|
||||
$pageCount = $this->pagination->getPageCount();
|
||||
if ($pageCount < 2 && $this->hideOnSinglePage) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$buttons = [];
|
||||
$currentPage = $this->pagination->getPage();
|
||||
|
||||
// first page
|
||||
if ($this->firstPageLabel !== FALSE) {
|
||||
$buttons[] = $this->renderPageButton($this->firstPageLabel, 0, $this->firstPageCssClass, $currentPage <= 0, FALSE);
|
||||
}
|
||||
|
||||
// prev page
|
||||
if ($this->prevPageLabel !== FALSE) {
|
||||
if (($page = $currentPage - 1) < 0) {
|
||||
$page = 0;
|
||||
}
|
||||
$buttons[] = $this->renderPageButton($this->prevPageLabel, $page, $this->prevPageCssClass, $currentPage <= 0, FALSE);
|
||||
}
|
||||
|
||||
// internal pages
|
||||
list($beginPage, $endPage) = $this->getPageRange();
|
||||
for ($i = $beginPage; $i <= $endPage; ++$i) {
|
||||
$buttons[] = $this->renderPageButton($i + 1, $i, NULL, FALSE, $i == $currentPage);
|
||||
}
|
||||
|
||||
// next page
|
||||
if ($this->nextPageLabel !== FALSE) {
|
||||
if (($page = $currentPage + 1) >= $pageCount - 1) {
|
||||
$page = $pageCount - 1;
|
||||
}
|
||||
$buttons[] = $this->renderPageButton($this->nextPageLabel, $page, $this->nextPageCssClass, $currentPage >= $pageCount - 1, FALSE);
|
||||
}
|
||||
|
||||
// last page
|
||||
if ($this->lastPageLabel !== FALSE) {
|
||||
$buttons[] = $this->renderPageButton($this->lastPageLabel, $pageCount - 1, $this->lastPageCssClass, $currentPage >= $pageCount - 1, FALSE);
|
||||
}
|
||||
|
||||
return html::tag('div', Html::tag('ul', implode("\n", $buttons), $this->options), ['class' => 'dataTables_paginate paging_bootstrap pagination']);
|
||||
//return Html::tag('ul', implode("\n", $buttons), $this->options);
|
||||
}
|
||||
}
|
@ -1 +0,0 @@
|
||||
|
@ -1,27 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<title>404</title>
|
||||
<style>
|
||||
body {
|
||||
background-color: #444;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 60px;
|
||||
color: #eee;
|
||||
text-align: center;
|
||||
padding-top: 30px;
|
||||
font-weight: normal;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h3>404,您请求的文件不存在!</h3>
|
||||
</body>
|
||||
</html>
|
@ -1,6 +0,0 @@
|
||||
版本记录说明
|
||||
|
||||
2.1.20210909
|
||||
添加版本记录号;
|
||||
修复管理员表、会员表、粉丝表、API用户表的归属及统一
|
||||
修复后台管理员资料编辑错误,微调昵称等细节部分
|
File diff suppressed because it is too large
Load Diff
@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace frontend\assets;
|
||||
|
||||
use yii\web\AssetBundle;
|
||||
|
||||
/**
|
||||
* Main frontend application asset bundle.
|
||||
*/
|
||||
class AppAsset extends AssetBundle
|
||||
{
|
||||
public $basePath = '@webroot';
|
||||
public $baseUrl = '@web';
|
||||
public $css = [
|
||||
'css/site.css',
|
||||
];
|
||||
public $js = [
|
||||
];
|
||||
public $depends = [
|
||||
'yii\web\YiiAsset',
|
||||
'yii\bootstrap5\BootstrapAsset',
|
||||
];
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 通讯证书文件
|
||||
@status 站点状态,-1禁止 0只读 1可用
|
||||
@siteId 站点ID
|
||||
@suIp 允许访问的IP
|
||||
@suDomain 允许访问的域名
|
||||
@api 接口用户名(站点用户名)
|
||||
@code 用户授权码
|
||||
@token 接口通讯的accesstoken文件
|
||||
*/
|
||||
$cert = array();
|
||||
$cert['id'] = '17';
|
||||
$cert['siteId'] = '1534755679';
|
||||
$cert['suIp'] = array('60.166.78.33');
|
||||
$cert['siteName'] = '';
|
||||
$cert['suDomain'] = array('http:');
|
||||
$cert['siteUrl'] = '';
|
||||
$cert['api'] = '1098765230@qq.com';
|
||||
$cert['code'] = '';
|
||||
$cert['token'] = '936cb496df78da7794f8d866ab4f9e0c';
|
||||
$cert['status'] = '0';
|
||||
$cert['remark'] = '新创建待审核,创建时间:2018-08-20 17:01:19';
|
||||
$cert['updatetime'] = '更新时间:2018-08-20 17:01:19';
|
||||
return $cert;
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 通讯证书文件
|
||||
@status 站点状态,-1禁止 0只读 1可用
|
||||
@siteId 站点ID
|
||||
@suIp 允许访问的IP
|
||||
@suDomain 允许访问的域名
|
||||
@api 接口用户名(站点用户名)
|
||||
@code 用户授权码
|
||||
@token 接口通讯的accesstoken文件
|
||||
*/
|
||||
$cert = array();
|
||||
$cert['id'] = '14';
|
||||
$cert['siteId'] = '27086';
|
||||
$cert['suIp'] = array('120.79.11.71');
|
||||
$cert['siteName'] = '';
|
||||
$cert['suDomain'] = array('');
|
||||
$cert['siteUrl'] = '';
|
||||
$cert['api'] = 'anchengjieshun';
|
||||
$cert['code'] = '';
|
||||
$cert['token'] = '9c20c06c513bcf9d8580a773d1a24124';
|
||||
$cert['status'] = '0';
|
||||
$cert['remark'] = '新创建待审核,创建时间:2018-05-02 09:56:11';
|
||||
$cert['updatetime'] = '更新时间:2019-01-20 11:40:48';
|
||||
return $cert;
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 通讯证书文件
|
||||
@status 站点状态,-1禁止 0只读 1可用
|
||||
@siteId 站点ID
|
||||
@suIp 允许访问的IP
|
||||
@suDomain 允许访问的域名
|
||||
@api 接口用户名(站点用户名)
|
||||
@code 用户授权码
|
||||
@token 接口通讯的accesstoken文件
|
||||
*/
|
||||
$cert = array();
|
||||
$cert['id'] = '6';
|
||||
$cert['siteId'] = '27086';
|
||||
$cert['suIp'] = array('127.0.0.1');
|
||||
$cert['siteName'] = '';
|
||||
$cert['suDomain'] = array('');
|
||||
$cert['siteUrl'] = '';
|
||||
$cert['api'] = 'dongjiabing';
|
||||
$cert['code'] = '';
|
||||
$cert['token'] = '5ff8745bffe82e58547d5ae4dd157250';
|
||||
$cert['status'] = '0';
|
||||
$cert['remark'] = '新创建待审核,创建时间:2017-08-15 20:57:21';
|
||||
$cert['updatetime'] = '更新时间:2017-09-22 13:14:12';
|
||||
return $cert;
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 通讯证书文件
|
||||
@status 站点状态,-1禁止 0只读 1可用
|
||||
@siteId 站点ID
|
||||
@suIp 允许访问的IP
|
||||
@suDomain 允许访问的域名
|
||||
@api 接口用户名(站点用户名)
|
||||
@code 用户授权码
|
||||
@token 接口通讯的accesstoken文件
|
||||
*/
|
||||
$cert = array();
|
||||
$cert['id'] = '22';
|
||||
$cert['siteId'] = '1540174304';
|
||||
$cert['suIp'] = array('110.52.216.185');
|
||||
$cert['siteName'] = '';
|
||||
$cert['suDomain'] = array('http:');
|
||||
$cert['siteUrl'] = '';
|
||||
$cert['api'] = 'howsou';
|
||||
$cert['code'] = '';
|
||||
$cert['token'] = 'ece82bff3ae54afa750872b01218df6d';
|
||||
$cert['status'] = '0';
|
||||
$cert['remark'] = '新创建待审核,创建时间:2018-10-22 10:11:44';
|
||||
$cert['updatetime'] = '更新时间:2018-10-22 10:13:56';
|
||||
return $cert;
|
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
return [
|
||||
'id' => '1', //证书ID
|
||||
'siteId' => '0', //站点ID
|
||||
'suIp' => ['::1', '127.0.0.1'], //允许访问的IP
|
||||
'siteName' => '本地测试站',
|
||||
'suDomain' => ['localhost'], //绑定域名
|
||||
'siteUrl' => '', //站点链接
|
||||
'api' => 'fm453_shopping', //授权API
|
||||
'sceret' => 'temp@te##453.com', //授权密钥
|
||||
'code' => 'Hiluker', //授权码
|
||||
'token' => '', //赋有有效期的Token(动态生成,此处暂不使用)
|
||||
'status' => '0', //站点状态,-1禁止0只读1可用
|
||||
'remark' => '本地测试时使用', //备注
|
||||
];
|
@ -1,27 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 通讯证书文件
|
||||
@status 站点状态,-1禁止 0只读 1可用
|
||||
@siteId 站点ID
|
||||
@suIp 允许访问的IP
|
||||
@suDomain 允许访问的域名
|
||||
@api 接口用户名(站点用户名)
|
||||
@code 用户授权码
|
||||
@token 接口通讯的accesstoken文件
|
||||
*/
|
||||
$cert = array();
|
||||
$cert['id'] = '4';
|
||||
$cert['siteId'] = '0';
|
||||
$cert['suIp'] = array('0.0.0.0/0');
|
||||
$cert['siteName'] = '公共接口站';
|
||||
$cert['suDomain'] = array('*');
|
||||
$cert['siteUrl'] = '';
|
||||
$cert['api'] = 'publicapi';
|
||||
$cert['code'] = 'Hiluker';
|
||||
$cert['token'] = '656733050cb05c7eacbd98bddab2784a';
|
||||
$cert['status'] = '1';
|
||||
$cert['remark'] = '公用接口账号';
|
||||
$cert['updatetime'] = '更新时间:2024-08-09 21:46:50';
|
||||
$cert['uniacid'] = '1';
|
||||
$cert['platid'] = '1';
|
||||
return $cert;
|
@ -1,24 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 通讯证书文件
|
||||
@status 站点状态,-1禁止 0只读 1可用
|
||||
@siteId 站点ID
|
||||
@suIp 允许访问的IP
|
||||
@suDomain 允许访问的域名
|
||||
@api 接口用户名(站点用户名)
|
||||
@code 用户授权码
|
||||
@token 接口通讯的accesstoken文件
|
||||
*/
|
||||
$cert = array();
|
||||
$cert['id'] = '12';
|
||||
$cert['siteId'] = '1548742316';
|
||||
$cert['suIp'] = array('116.62.209.203');
|
||||
$cert['siteName'] = '';
|
||||
$cert['suDomain'] = array('');
|
||||
$cert['siteUrl'] = '';
|
||||
$cert['api'] = 'ukl';
|
||||
$cert['code'] = '';
|
||||
$cert['token'] = 'fa919dafaed937db58047791efe413f7';
|
||||
$cert['status'] = '0';
|
||||
$cert['remark'] = '新创建待审核,创建时间:2019-01-29 14:11:56';
|
||||
return $cert;
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
return [
|
||||
'id' => '2', //证书ID
|
||||
'siteId' => '27086', //站点ID
|
||||
'suIp' => ['::1', '127.0.0.1', '61.147.125.206'], //允许访问的IP
|
||||
'siteName' => 'VCMS微信管理系统',
|
||||
'suDomain' => ['vcms.hiluker.com'], //绑定域名
|
||||
'siteUrl' => '', //站点链接
|
||||
'api' => 'fm453_shopping', //授权API
|
||||
'sceret' => 'temp@te##453.com', //授权密钥
|
||||
'code' => 'Hiluker', //授权码
|
||||
'token' => '', //赋有有效期的Token(动态生成,此处暂不使用)
|
||||
'status' => '1', //站点状态,-1禁止0只读1可用
|
||||
'remark' => 'VCMS微信管理系统使用', //备注
|
||||
//'platid' => '1', //直接固定platid值
|
||||
];
|
@ -1,26 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 通讯证书文件
|
||||
@status 站点状态,-1禁止 0只读 1可用
|
||||
@siteId 站点ID
|
||||
@suIp 允许访问的IP
|
||||
@suDomain 允许访问的域名
|
||||
@api 接口用户名(站点用户名)
|
||||
@code 用户授权码
|
||||
@token 接口通讯的accesstoken文件
|
||||
*/
|
||||
$cert = array();
|
||||
$cert['id'] = '2';
|
||||
$cert['siteId'] = '27086';
|
||||
$cert['suIp'] = array('61.147.111.178', '127.0.0.1', '::1');
|
||||
$cert['siteName'] = 'VCMS微信管理系统';
|
||||
$cert['suDomain'] = array('vcms.localhost');
|
||||
$cert['siteUrl'] = '';
|
||||
$cert['api'] = 'fm453_shopping';
|
||||
$cert['sceret'] = 'temp@te##453.com';
|
||||
$cert['code'] = 'Hiluker';
|
||||
$cert['token'] = 'bca3402b510ecd8e3603ebf746f4fbfa';
|
||||
$cert['status'] = '1';
|
||||
$cert['remark'] = 'VCMS微信管理本地开发测试系统';
|
||||
$cert['updatetime'] = '更新时间:2018-04-23 15:52:33';
|
||||
return $cert;
|
@ -1,27 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 通讯证书文件
|
||||
@status 站点状态,-1禁止 0只读 1可用
|
||||
@siteId 站点ID
|
||||
@suIp 允许访问的IP
|
||||
@suDomain 允许访问的域名
|
||||
@api 接口用户名(站点用户名)
|
||||
@code 用户授权码
|
||||
@token 接口通讯的accesstoken文件
|
||||
*/
|
||||
$cert = array();
|
||||
$cert['id'] = '15';
|
||||
$cert['siteId'] = '27086';
|
||||
$cert['suIp'] = array('120.79.11.71');
|
||||
$cert['siteName'] = '';
|
||||
$cert['suDomain'] = array('');
|
||||
$cert['siteUrl'] = '';
|
||||
$cert['api'] = 'www.haijumeng.com';
|
||||
$cert['code'] = '';
|
||||
$cert['token'] = '0da3957934b098592c557c6281ca4922';
|
||||
$cert['status'] = '0';
|
||||
$cert['remark'] = '新创建待审核,创建时间:2018-05-02 08:52:09';
|
||||
$cert['updatetime'] = '更新时间:2018-06-08 23:19:50';
|
||||
$cert['platid'] = '1';
|
||||
$cert['uniacid'] = '111';
|
||||
return $cert;
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 通讯证书文件
|
||||
@status 站点状态,-1禁止 0只读 1可用
|
||||
@siteId 站点ID
|
||||
@suIp 允许访问的IP
|
||||
@suDomain 允许访问的域名
|
||||
@api 接口用户名(站点用户名)
|
||||
@code 用户授权码
|
||||
@token 接口通讯的accesstoken文件
|
||||
*/
|
||||
$cert = array();
|
||||
$cert['id'] = '21';
|
||||
$cert['siteId'] = '1528471799';
|
||||
$cert['suIp'] = array('36.57.163.170');
|
||||
$cert['siteName'] = '';
|
||||
$cert['suDomain'] = array('');
|
||||
$cert['siteUrl'] = '';
|
||||
$cert['api'] = 'xcx.hiluker.com';
|
||||
$cert['code'] = 'Hiluker.com';
|
||||
$cert['token'] = 'fda11ae350f6b1a231ce62766fd09dd6';
|
||||
$cert['status'] = '0';
|
||||
$cert['remark'] = '新创建待审核,创建时间:2018-06-08 23:29:59';
|
||||
$cert['updatetime'] = '更新时间:2018-06-08 23:29:59';
|
||||
return $cert;
|
@ -1,15 +0,0 @@
|
||||
namespace: frontend\tests
|
||||
actor: Tester
|
||||
paths:
|
||||
tests: tests
|
||||
log: tests/_output
|
||||
data: tests/_data
|
||||
helpers: tests/_support
|
||||
settings:
|
||||
bootstrap: _bootstrap.php
|
||||
colors: true
|
||||
memory_limit: 1024M
|
||||
modules:
|
||||
config:
|
||||
Yii2:
|
||||
configFile: 'config/test-local.php'
|
3
dacms-home/config/.gitignore
vendored
3
dacms-home/config/.gitignore
vendored
@ -1,3 +0,0 @@
|
||||
main-local.php
|
||||
params-local.php
|
||||
test-local.php
|
@ -1,2 +0,0 @@
|
||||
<?php
|
||||
Yii::setAlias('@frontend', dirname(__DIR__));
|
@ -1,4 +0,0 @@
|
||||
<?php
|
||||
|
||||
global $_HI;
|
||||
$_HI['apiCertPath'] = Yii::getAlias('@frontend/cert/');
|
@ -1,49 +0,0 @@
|
||||
<?php
|
||||
|
||||
$config = [
|
||||
'components' => [
|
||||
'db' => [
|
||||
'class' => 'yii\db\Connection',
|
||||
'dsn' => 'mysql:host=127.0.0.1;dbname=sass',
|
||||
'username' => 'sass',
|
||||
'password' => 'ejxsrxZCP34xNjF2',
|
||||
'charset' => 'utf8',
|
||||
'tablePrefix' => '',
|
||||
'attributes' => [
|
||||
// use a smaller connection timeout
|
||||
PDO::ATTR_TIMEOUT => 10,
|
||||
//使用长链接
|
||||
PDO::ATTR_PERSISTENT => TRUE,
|
||||
],
|
||||
],
|
||||
//添加CHAT数据库配置(聊天室模块)
|
||||
'chatdb' => [
|
||||
'class' => 'yii\db\Connection',
|
||||
'dsn' => 'mysql:host=127.0.0.1;dbname=sass',
|
||||
'username' => 'sass',
|
||||
'password' => 'ejxsrxZCP34xNjF2',
|
||||
'charset' => 'utf8',
|
||||
'tablePrefix' => '',
|
||||
],
|
||||
//添加REALTY数据库配置(房地产模块)
|
||||
'realtydb' => [
|
||||
'class' => 'yii\db\Connection',
|
||||
'dsn' => 'mysql:host=127.0.0.1;dbname=sass',
|
||||
'username' => 'sass',
|
||||
'password' => 'ejxsrxZCP34xNjF2',
|
||||
'charset' => 'utf8',
|
||||
'tablePrefix' => '',
|
||||
],
|
||||
//添加PAGE数据库配置(页面模块)
|
||||
'pagedb' => [
|
||||
'class' => 'yii\db\Connection',
|
||||
'dsn' => 'mysql:host=127.0.0.1;dbname=sass',
|
||||
'username' => 'sass',
|
||||
'password' => 'ejxsrxZCP34xNjF2',
|
||||
'charset' => 'utf8',
|
||||
'tablePrefix' => '',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
return $config;
|
@ -1,56 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @Author: fm453
|
||||
* @Date: 2021-09-09 10:37:17
|
||||
* @Last Modified by: fm453
|
||||
* @Last Modified time: 2021-09-09 10:42:24
|
||||
* @Email: fm453@lukegzs.com
|
||||
*/
|
||||
$config = [
|
||||
'components' => [
|
||||
'db' => [
|
||||
'class' => 'yii\db\Connection',
|
||||
'dsn' => 'mysql:host=127.0.0.1;dbname=dacms',
|
||||
'username' => 'dacms',
|
||||
'password' => 'CiwE5YbLnL7Yw8zs',
|
||||
'charset' => 'utf8',
|
||||
'tablePrefix' => '',
|
||||
'attributes' => [
|
||||
// use a smaller connection timeout
|
||||
PDO::ATTR_TIMEOUT => 10,
|
||||
//使用长链接
|
||||
PDO::ATTR_PERSISTENT => TRUE,
|
||||
],
|
||||
],
|
||||
//添加CHAT数据库配置(聊天室模块)
|
||||
'chatdb' => [
|
||||
'class' => 'yii\db\Connection',
|
||||
'dsn' => 'mysql:host=127.0.0.1;dbname=dacms',
|
||||
'username' => 'dacms',
|
||||
'password' => 'CiwE5YbLnL7Yw8zs',
|
||||
'charset' => 'utf8',
|
||||
'tablePrefix' => '',
|
||||
],
|
||||
//添加REALTY数据库配置(房地产模块)
|
||||
'realtydb' => [
|
||||
'class' => 'yii\db\Connection',
|
||||
'dsn' => 'mysql:host=127.0.0.1;dbname=dacms',
|
||||
'username' => 'dacms',
|
||||
'password' => 'CiwE5YbLnL7Yw8zs',
|
||||
'charset' => 'utf8',
|
||||
'tablePrefix' => '',
|
||||
],
|
||||
//添加PAGE数据库配置(页面模块)
|
||||
'pagedb' => [
|
||||
'class' => 'yii\db\Connection',
|
||||
'dsn' => 'mysql:host=127.0.0.1;dbname=dacms',
|
||||
'username' => 'dacms',
|
||||
'password' => 'CiwE5YbLnL7Yw8zs',
|
||||
'charset' => 'utf8',
|
||||
'tablePrefix' => '',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
return $config;
|
@ -1,67 +0,0 @@
|
||||
<?php
|
||||
# @Author: 嗨噜客科技(www.hiluker.cn) <Fm453>
|
||||
# @Date: 1970-01-01T08:00:00+08:00
|
||||
# @Email: fm453@hiluker.com
|
||||
# @Last modified by: Fm453
|
||||
# @Last modified time: 2021-09-15T00:13:16+08:00
|
||||
|
||||
$params = array_merge(
|
||||
require(__DIR__ . '/../../common/config/params-api.php'),
|
||||
require(__DIR__ . '/../../common/config/params.php'),
|
||||
require(__DIR__ . '/params.php')
|
||||
);
|
||||
|
||||
$config = [
|
||||
'id' => 'app-frontend',
|
||||
'basePath' => dirname(__DIR__),
|
||||
'bootstrap' => ['log'],
|
||||
'controllerNamespace' => 'frontend\controllers',
|
||||
'modules' => [
|
||||
'data' => [
|
||||
'class' => 'vendor\fmsoft\modules\data\Module', //自动加载我的数据处理模型
|
||||
],
|
||||
],
|
||||
'language' => 'zh-CN',
|
||||
'components' => [
|
||||
'request' => [
|
||||
'csrfParam' => '_csrf-frontend',
|
||||
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
|
||||
'cookieValidationKey' => 'o_Rv6TiAxMkGII4dkFBKathreA5IEohp',
|
||||
'parsers' => [
|
||||
'application/json' => 'yii\web\JsonParser',
|
||||
]
|
||||
],
|
||||
'user' => [
|
||||
'identityClass' => 'common\models\User',
|
||||
'enableAutoLogin' => TRUE,
|
||||
'identityCookie' => ['name' => '_identity-frontend', 'httpOnly' => TRUE],
|
||||
],
|
||||
'session' => [
|
||||
'name' => 'advanced-frontend-api',
|
||||
],
|
||||
'log' => [
|
||||
'traceLevel' => YII_DEBUG ? 3 : 0,
|
||||
'targets' => [
|
||||
[
|
||||
'class' => 'yii\log\FileTarget',
|
||||
'levels' => ['error', 'warning'],
|
||||
],
|
||||
],
|
||||
],
|
||||
'errorHandler' => [
|
||||
'errorAction' => 'site/error',
|
||||
],
|
||||
'urlManager' => [
|
||||
'enablePrettyUrl' => FALSE,
|
||||
'enableStrictParsing' => TRUE,
|
||||
'showScriptName' => TRUE,
|
||||
'suffix' => '.hi',
|
||||
'rules' => [
|
||||
['class' => 'yii\rest\UrlRule', 'controller' => 'realty'], //为***控制器增加一个 URL 规则。这样, 用户的数据就能通过美化的 URL 和有意义的 http 动词进行访问和操作
|
||||
['class' => 'yii\rest\UrlRule', 'controller' => 'setting']
|
||||
],
|
||||
],
|
||||
],
|
||||
'params' => $params,
|
||||
];
|
||||
return $config;
|
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
# @Author: 嗨噜客科技(www.hiluker.cn) <Fm453>
|
||||
# @Date: 1970-01-01T08:00:00+08:00
|
||||
# @Email: fm453@hiluker.com
|
||||
# @Last modified by: Fm453
|
||||
# @Last modified time: 2021-09-15T00:09:07+08:00
|
||||
|
||||
return [
|
||||
'adminEmail' => 'fm453@lukegzs.com',
|
||||
'redis' => ['IP' => '127.0.0.1', 'PORT' => '6379']
|
||||
];
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
return [
|
||||
'id' => 'app-frontend-tests',
|
||||
'components' => [
|
||||
'assetManager' => [
|
||||
'basePath' => __DIR__ . '/../web/assets',
|
||||
],
|
||||
],
|
||||
];
|
@ -1,235 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @Author: fm453
|
||||
* @Date: 2018-06-04 11:06:07
|
||||
* @Last Modified by: fm453
|
||||
* @Last Modified time: 2019-11-11 13:11:55
|
||||
* @Email: fm453@lukegzs.com
|
||||
*/
|
||||
|
||||
namespace frontend\controllers;
|
||||
|
||||
use Yii;
|
||||
use yii\helpers\Url;
|
||||
use vendor\aliyun\dysms\Sms;
|
||||
|
||||
require dirname(__FILE__) . '/_public/public.php';
|
||||
|
||||
class AlimsgController extends \yii\web\Controller
|
||||
{
|
||||
public $enableCsrfValidation = FALSE;//取消对POST数据的csrf令牌验证
|
||||
|
||||
public function actionIndex()
|
||||
{
|
||||
global $_HI;
|
||||
global $_FM;
|
||||
$_HI['action'] = 'index';
|
||||
/*自定义常量*/
|
||||
|
||||
/*默认配置*/
|
||||
$_HI['accessKeyId'] = 'LTAIQrJFtHfqsyOt'; // AccessKeyId
|
||||
$_HI['accessKeySecret'] = 'tvGieI3vNI7Si3imauCB4rJ3OX4AR8'; // AccessKeySecret
|
||||
$_HI['sign'] = '嗨路客';
|
||||
$_HI['tmpl'] = 'SMS_116695055';
|
||||
|
||||
$_HI['reportQueueName'] = 'Alicom-Queue-31737903-SmsReport'; //状态报告接收
|
||||
$_HI['UpQueueName'] = 'Alicom-Queue-31737903-SmsUp'; //上行消息接收
|
||||
|
||||
return $this->render('index');
|
||||
}
|
||||
|
||||
public function actionSend()
|
||||
{
|
||||
global $_HI;
|
||||
global $_FM;
|
||||
global $START_TIME;
|
||||
|
||||
$_HI['action'] = 'post';
|
||||
//数据取出方法
|
||||
$dataPost = Yii::$app->request->post(); //YII应用内的真实或模拟POST数据
|
||||
$dataGet = Yii::$app->request->get(); //YII应用内的真实或模拟GET数据
|
||||
$params = Yii::$app->params;
|
||||
|
||||
$config = array();
|
||||
$config['accessKeyId'] = isset($dataPost['accessKeyId']) ? $dataPost['accessKeyId'] : '';
|
||||
$config['accessKeySecret'] = isset($dataPost['accessKeySecret']) ? $dataPost['accessKeySecret'] : '';
|
||||
$config['sign'] = isset($dataPost['sign']) ? $dataPost['sign'] : '';
|
||||
|
||||
$option = array();
|
||||
|
||||
$_content = isset($dataPost['content']) ? $dataPost['content'] : '';
|
||||
$_content = explode("\r\n", $_content);
|
||||
$content = array();
|
||||
foreach ($_content as $c) {
|
||||
$_c = explode(',', $c);
|
||||
$k = trim($_c[0]);
|
||||
$v = trim($_c[1]);
|
||||
$content[$k] = $v;
|
||||
}
|
||||
unset($_c);
|
||||
unset($k);
|
||||
unset($v);
|
||||
|
||||
$phone = isset($dataPost['phone']) ? $dataPost['phone'] : '';
|
||||
if ($phone) {
|
||||
$phone = explode(',', $phone);
|
||||
$phone = array_unique($phone); //去重
|
||||
$phone = array_filter($phone); //去空
|
||||
}
|
||||
|
||||
|
||||
$tmpl = isset($dataPost['tmpl']) ? $dataPost['tmpl'] : '';
|
||||
|
||||
if (isset($_GET['post']) && $_GET['post'] == 1) {
|
||||
$_POST = array('config' => $config, 'option' => $option, 'phone' => $phone, 'content' => $content, 'tmpl' => $tmpl);
|
||||
Yii::$app->request->setBodyParams($_POST); //重写模拟POST数据
|
||||
// Yii::$app->request->setQueryParams($_POST); //重写模拟GET数据
|
||||
return $this->actionPost($_POST);
|
||||
}
|
||||
|
||||
$sms = new Sms($option, $config);
|
||||
|
||||
$results = array();
|
||||
$msg = "";
|
||||
foreach ($phone as $p) {
|
||||
$result = $sms->send($p, $tmpl, $content);
|
||||
$results[$p] = $result;
|
||||
if (!$result) {
|
||||
$msg .= "【" . $p . "】发送失败,接口提示:" . $sms->errors . "\r\n";
|
||||
} else if (is_array($result) && $result['Code'] != 'OK') {
|
||||
$msg .= "【" . $p . "】发送失败,接口提示:" . $result['Message'] . "\r\n";
|
||||
} else {
|
||||
$msg .= "【" . $p . "】发送成功" . "\r\n";
|
||||
}
|
||||
}
|
||||
|
||||
$message = array();
|
||||
$message['title'] = "阿里云短信发送测试";
|
||||
$message['class'] = "success";
|
||||
$message['button'] = array();
|
||||
$message['content'] = "短信发送完毕;接口返回:" . $msg;
|
||||
$message['button'][] = array("class" => "btn btn-success", "title" => "首页", "link" => Url::toRoute('site/index'));
|
||||
$message['button'][] = array("class" => "btn btn-info", "title" => "接口", "link" => Url::toRoute(['api/index', 'appid' => Yii::$app->user->identity->username]));
|
||||
return $this->render('//layouts/message.php', [
|
||||
'message' => $message
|
||||
]);
|
||||
}
|
||||
|
||||
public function actionPost()
|
||||
{
|
||||
global $_HI;
|
||||
global $_FM;
|
||||
global $START_TIME;
|
||||
|
||||
$_HI['action'] = 'post';
|
||||
//数据取出方法
|
||||
$dataPost = Yii::$app->request->post(); //YII应用内的真实或模拟POST数据
|
||||
$dataGet = Yii::$app->request->get(); //YII应用内的真实或模拟GET数据
|
||||
$params = Yii::$app->params;
|
||||
fmFunc_stat_times_in($username = $_FM['user']['name'], 1); //增加一次接口入站次数累计
|
||||
fmFunc_stat_bytes_in($username = $_FM['user']['name'], strlen(json_encode($dataPost))); //增加一次接口入站数据量累计
|
||||
|
||||
$return = array();
|
||||
$results = array();
|
||||
$msg = "";
|
||||
$errorCode = 0;
|
||||
|
||||
if (!isset($dataPost['config']) || !is_array($dataPost['config'])) {
|
||||
$errorCode = '45300403';
|
||||
$return['errorcode'] = $errorCode;
|
||||
$return['msg'] = Yii::t('errorcode', $errorCode);
|
||||
return json_encode($return);
|
||||
}
|
||||
$config = $dataPost['config'];
|
||||
|
||||
if (isset($dataPost['option'])) {
|
||||
if (!is_array($dataPost['option'])) {
|
||||
$errorCode = '45300404';
|
||||
$return['errorcode'] = $errorCode;
|
||||
$return['msg'] = Yii::t('errorcode', $errorCode);
|
||||
return json_encode($return);
|
||||
}
|
||||
$option = $dataPost['option'];
|
||||
} else {
|
||||
$option = array();
|
||||
}
|
||||
|
||||
if (!isset($dataPost['tmpl']) || !is_string($dataPost['tmpl'])) {
|
||||
$errorCode = '45300405';
|
||||
$return['errorcode'] = $errorCode;
|
||||
$return['msg'] = Yii::t('errorcode', $errorCode);
|
||||
return json_encode($return);
|
||||
}
|
||||
$tmpl = $dataPost['tmpl'];
|
||||
|
||||
if (!isset($dataPost['phone']) || !is_array($dataPost['phone'])) {
|
||||
$errorCode = '45300406';
|
||||
$return['errorcode'] = $errorCode;
|
||||
$return['msg'] = Yii::t('errorcode', $errorCode);
|
||||
return json_encode($return);
|
||||
}
|
||||
$phone = $dataPost['phone'];
|
||||
|
||||
if (isset($dataPost['content'])) {
|
||||
if (!is_array($dataPost['content'])) {
|
||||
$errorCode = '45300407';
|
||||
$return['errorcode'] = $errorCode;
|
||||
$return['msg'] = Yii::t('errorcode', $errorCode);
|
||||
return json_encode($return);
|
||||
}
|
||||
$content = $dataPost['content'];
|
||||
} else {
|
||||
$content = array();
|
||||
}
|
||||
|
||||
$sms = new Sms($option, $config);
|
||||
$error = $sms->errors;
|
||||
if ($error) {
|
||||
$errorCode = '45300402';
|
||||
$return['errorcode'] = $errorCode;
|
||||
$return['msg'] = Yii::t('errorcode', $errorCode) . ";接口提示:" . $sms->errors . ";";;
|
||||
return json_encode($return);
|
||||
}
|
||||
|
||||
$results = array();
|
||||
$msg = "";
|
||||
$errors = 0;
|
||||
$pn = count($phone);
|
||||
foreach ($phone as $p) {
|
||||
$result = $sms->send($p, $tmpl, $content);
|
||||
var_dump($result);
|
||||
die();
|
||||
$results[$p] = $result;
|
||||
if (!$result) {
|
||||
$msg .= "【" . $p . "】发送失败,接口提示:" . $sms->errors . ";";
|
||||
$errors += 1;
|
||||
} else if (is_array($result) && $result['Code'] != 'OK') {
|
||||
$msg .= "【" . $p . "】发送失败,接口提示:" . $result['Message'] . ";";
|
||||
$errors += 1;
|
||||
} else {
|
||||
$msg .= "【" . $p . "】发送成功" . ";";
|
||||
}
|
||||
}
|
||||
|
||||
if ($errors > 0) {
|
||||
if ($errors == $pn) {
|
||||
$errorcode = 45300402;
|
||||
} else {
|
||||
$errorcode = 45300401;
|
||||
}
|
||||
}
|
||||
|
||||
$return['errorcode'] = $errorCode;
|
||||
$return['msg'] = Yii::t('errorcode', $errorCode) . ";" . $msg;
|
||||
$return['data'] = $dataPost;
|
||||
$return['timeused'] = getMillisecond() - $START_TIME;
|
||||
$return['total'] = isset($count) ? $count : 1;//总记录数
|
||||
$return['bytes'] = strlen(json_encode($return['data']));//长度字节统计
|
||||
fmFunc_stat_times_out($username = $_FM['user']['name'], 1); //增加一次接口出站次数累计
|
||||
fmFunc_stat_bytes_out($username = $_FM['user']['name'], $return['bytes']); //增加一次接口出站数据量累计
|
||||
$return['sms_left'] = fmFunc_stat_sms_send($username = $_FM['user']['name'], $times = $pn - $errors); //统计短信发送并返回剩余条数
|
||||
return json_encode($return);
|
||||
}
|
||||
|
||||
}
|
@ -1,100 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace frontend\controllers;
|
||||
|
||||
use Yii;
|
||||
use yii\helpers\Url;
|
||||
use common\models\User;
|
||||
use common\models\CAccess;
|
||||
|
||||
require dirname(__FILE__) . '/_public/public_demo.php';
|
||||
|
||||
class ApiController extends \yii\web\Controller
|
||||
{
|
||||
public $enableCsrfValidation = FALSE;//取消对POST数据的csrf令牌验证
|
||||
|
||||
public function actionIndex()
|
||||
{
|
||||
global $_GPC;
|
||||
global $_HI;
|
||||
global $_FM;
|
||||
$_HI['action'] = 'index';
|
||||
$identity = Yii::$app->user->identity;
|
||||
if (!$identity) {
|
||||
return $this->goHome();
|
||||
}
|
||||
$_FM['user']['name'] = $identity->username;
|
||||
$_FM['user']['uid'] = $identity->id;
|
||||
|
||||
fmFunc_cert_afterLogin();
|
||||
|
||||
return $this->render('index');
|
||||
}
|
||||
|
||||
public function actionTest()
|
||||
{
|
||||
global $_GPC;
|
||||
global $_HI;
|
||||
global $_FM;
|
||||
global $START_TIME;
|
||||
$_HI['action'] = 'test';
|
||||
|
||||
$request = Yii::$app->request;
|
||||
$request->enableCsrfValidation = FALSE;
|
||||
|
||||
// 返回所有参数
|
||||
$params = $request->get();
|
||||
$_FM['params'] = $params;
|
||||
$accesstoken = isset($_FM['params']['accesstoken']) ? $_FM['params']['accesstoken'] : '';
|
||||
//查询用户信息(根据username)
|
||||
$user = CAccess::findOne(['accesstoken' => $accesstoken]);
|
||||
if ($user) {
|
||||
$user = $user->toArray();
|
||||
} else {
|
||||
$errorCode = 45300001; //未找到用户
|
||||
$result = array();
|
||||
$result['errorcode'] = $errorCode;
|
||||
$result['msg'] = Yii::t('errorcode', $errorCode);
|
||||
$result = json_encode($result);
|
||||
die ($result);
|
||||
}
|
||||
$_FM['user'] = $user;
|
||||
$_FM['user']['name'] = $_FM['user']['username'];
|
||||
$cert = fmFunc_cert_exist($_FM['user']['name']);
|
||||
$_FM['apiCert'] = $cert;
|
||||
if ($request->isAjax) {
|
||||
/* 该请求是一个 AJAX 请求 */
|
||||
$result = json_encode(1);
|
||||
}
|
||||
if ($request->isGet) {
|
||||
/* 请求方法是 GET */
|
||||
|
||||
}
|
||||
if ($request->isPost) {
|
||||
/* 请求方法是 POST */
|
||||
}
|
||||
if ($request->isPut) {
|
||||
/* 请求方法是 PUT */
|
||||
|
||||
}
|
||||
|
||||
###定义内容类型###
|
||||
//header('Content-Type: text/html; charset=utf-8'); //网页编码
|
||||
//header('Content-Type: text/plain'); //纯文本格式
|
||||
//header('Content-Type: image/jpeg'); //JPG、JPEG
|
||||
//header('Content-Type: application/zip'); // ZIP文件
|
||||
//header('Content-Type: application/pdf'); // PDF文件
|
||||
//header('Content-Type: audio/mpeg'); // 音频文件
|
||||
//header('Content-type: text/css'); //css文件
|
||||
//header('Content-type: text/javascript'); //js文件
|
||||
//header('Content-Type: application/x-shockw**e-flash'); //Flash动画
|
||||
//header('Content-type: application/pdf'); //pdf
|
||||
//header('Content-type: text/xml'); //xml
|
||||
header('Content-type: application/json'); //json
|
||||
$_FM['apiCert']['timeused'] = getMillisecond() - $START_TIME;
|
||||
$_FM['apiCert']['stat'] = fmFunc_stat_get($username = $_FM['user']['username']);
|
||||
$result = json_encode($_FM['apiCert']);
|
||||
die($result);
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user