初始化代码
This commit is contained in:
132
app/massage/controller/Admin.php
Normal file
132
app/massage/controller/Admin.php
Normal file
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
namespace app\massage\controller;
|
||||
use app\AdminRest;
|
||||
use app\BaseController;
|
||||
use think\App;
|
||||
use app\shop\model\Admin as Model;
|
||||
|
||||
use think\facade\Db;
|
||||
use think\facade\Lang;
|
||||
use think\Response;
|
||||
|
||||
class Admin extends BaseController
|
||||
{
|
||||
|
||||
|
||||
protected $model;
|
||||
|
||||
protected $config_model;
|
||||
|
||||
|
||||
|
||||
public function __construct(App $app) {
|
||||
|
||||
parent::__construct($app);
|
||||
|
||||
$this->model = new Model();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-11 13:53
|
||||
* @功能说明:登陆
|
||||
*/
|
||||
public function login(){
|
||||
|
||||
// $input = $this->_input;
|
||||
|
||||
initLogin();
|
||||
|
||||
$input = json_decode( $this->request->getInput(), true );
|
||||
|
||||
//dump($input);exit;
|
||||
|
||||
$dis = [
|
||||
|
||||
// 'uniacid' => $this->_uniacid,
|
||||
|
||||
'username'=> $input['username']
|
||||
];
|
||||
|
||||
$data = $this->model->dataInfo($dis);
|
||||
|
||||
if(empty($data)){
|
||||
|
||||
return $this->error('该用户不存在', 400);
|
||||
|
||||
}
|
||||
|
||||
if($data['passwd']!=checkPass($input['passwd'])){
|
||||
|
||||
|
||||
return $this->error('密码错误', 400);
|
||||
}
|
||||
|
||||
$result['user'] = $data;
|
||||
|
||||
$result['token'] = uuid();
|
||||
|
||||
if (empty($result['token'])) {
|
||||
|
||||
return $this->error('系统错误', 400);
|
||||
}
|
||||
//添加缓存数据
|
||||
setUserForToken($result['token'], $data, 99999999);
|
||||
|
||||
return $this->success($result);
|
||||
|
||||
}
|
||||
|
||||
public function success ( $data, $code = 200 )
|
||||
{
|
||||
$result[ 'data' ] = $data;
|
||||
$result[ 'code' ] = $code;
|
||||
$result[ 'sign' ] = null;
|
||||
//复杂的签名
|
||||
// if(isset($this->_user['keys'])){
|
||||
// $result['sign'] = rsa2CreateSign($this->_user['keys'] ,json_encode($data));
|
||||
// }
|
||||
//简单的签名
|
||||
if ( !empty( $this->_token ) ) $result[ 'sign' ] = createSimpleSign( $this->_token, is_string( $data ) ? $data : json_encode( $data ) );
|
||||
|
||||
return $this->response( $result, 'json', $code );
|
||||
}
|
||||
|
||||
//返回错误数据
|
||||
public function error ( $msg, $code = 400 )
|
||||
{
|
||||
$result[ 'error' ] = Lang::get($msg);
|
||||
$result[ 'code' ] = $code;
|
||||
return $this->response( $result, 'json', 200 );
|
||||
}
|
||||
|
||||
/**
|
||||
* 输出返回数据
|
||||
* @access protected
|
||||
* @param mixed $data 要返回的数据
|
||||
* @param String $type 返回类型 JSON XML
|
||||
* @param integer $code HTTP状态码
|
||||
* @return Response
|
||||
*/
|
||||
protected function response ( $data, $type = 'json', $code = 200 )
|
||||
{
|
||||
return Response::create( $data, $type )->code( $code );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
441
app/massage/controller/AdminAtv.php
Normal file
441
app/massage/controller/AdminAtv.php
Normal file
@@ -0,0 +1,441 @@
|
||||
<?php
|
||||
namespace app\massage\controller;
|
||||
use app\AdminRest;
|
||||
|
||||
|
||||
use app\massage\model\CarAtvContent;
|
||||
use app\massage\model\CarAtvList;
|
||||
use app\massage\model\CarAtvRecord;
|
||||
use app\massage\model\CarDriver;
|
||||
use app\massage\model\CarGame;
|
||||
use app\massage\model\User;
|
||||
use think\App;
|
||||
|
||||
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
class AdminAtv extends AdminRest
|
||||
{
|
||||
|
||||
protected $model;
|
||||
|
||||
protected $content_model;
|
||||
|
||||
protected $record_model;
|
||||
|
||||
public function __construct(App $app) {
|
||||
|
||||
parent::__construct($app);
|
||||
|
||||
$this->model = new CarAtvList();
|
||||
|
||||
$this->content_model = new CarAtvContent();
|
||||
|
||||
$this->record_model = new CarAtvRecord();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 13:28
|
||||
* @功能说明:内容列表
|
||||
*/
|
||||
public function contentList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis[] = ['uniacid','=',$this->_uniacid];
|
||||
|
||||
$dis[] = ['status','>',-1];
|
||||
|
||||
$data = $this->content_model->dataList($dis,$input['limit']);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 13:28
|
||||
* @功能说明:内容列表
|
||||
*/
|
||||
public function contentSelect(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis[] = ['uniacid','=',$this->_uniacid];
|
||||
|
||||
$dis[] = ['status','=',1];
|
||||
|
||||
$data = $this->content_model->where($dis)->order('id desc')->select()->toArray();
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 13:28
|
||||
* @功能说明:详情
|
||||
*/
|
||||
public function contentInfo(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$data = $this->content_model->dataInfo($dis);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 13:29
|
||||
* @功能说明:添加活动详情
|
||||
*/
|
||||
public function contentAdd(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$input['uniacid'] = $this->_uniacid;
|
||||
|
||||
$data = $this->content_model->dataAdd($input);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 13:29
|
||||
* @功能说明:编辑活动详情
|
||||
*/
|
||||
public function contentUpdate(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
if(isset($input['status'])&&in_array($input['status'],[-1,0])){
|
||||
|
||||
$find = $this->model->atvContentIng($input['id']);
|
||||
|
||||
if(!empty($find)){
|
||||
|
||||
$this->errorMsg('该内容正在被使用');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$data = $this->content_model->dataUpdate($dis,$input);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 13:28
|
||||
* @功能说明:内容列表
|
||||
*/
|
||||
public function atvList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$this->model->initAtv();
|
||||
|
||||
$dis[] = ['uniacid','=',$this->_uniacid];
|
||||
|
||||
$dis[] = ['status','>',-1];
|
||||
|
||||
if(!empty($input['title'])){
|
||||
|
||||
$dis[] = ['title','like','%'.$input['title'].'%'];
|
||||
}
|
||||
|
||||
if(!empty($input['status'])){
|
||||
|
||||
$dis[] = ['atv_status','=',$input['status']];
|
||||
}
|
||||
|
||||
$data = $this->model->dataList($dis,$input['limit']);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 13:28
|
||||
* @功能说明:详情
|
||||
*/
|
||||
public function atvInfo(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$data = $this->model->dataInfo($dis);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 13:29
|
||||
* @功能说明:添加活动详情
|
||||
*/
|
||||
public function atvAdd(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$input['uniacid'] = $this->_uniacid;
|
||||
|
||||
$data = $this->model->dataAdd($input);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 13:29
|
||||
* @功能说明:编辑活动详情
|
||||
*/
|
||||
public function atvUpdate(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$input['uniacid'] = $this->_uniacid;
|
||||
|
||||
$info = $this->model->dataInfo($dis);
|
||||
|
||||
if(isset($input['atv_num'])&&$input['atv_num']<$info['have_num']){
|
||||
|
||||
$this->errorMsg('报名人数不能小于已经报名人数,已报名'.$info['have_num']);
|
||||
}
|
||||
|
||||
$data = $this->model->dataUpdate($dis,$input);
|
||||
|
||||
if(!empty($input['atv_s_time'])&&!empty($input['atv_e_time'])){
|
||||
//同步活动报名时间
|
||||
$update = [
|
||||
|
||||
'start_time' => $input['atv_s_time'],
|
||||
|
||||
'end_time' => $input['atv_e_time'],
|
||||
];
|
||||
|
||||
$this->record_model->dataUpdate(['atv_id'=>$input['id']],$update);
|
||||
}
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-16 15:41
|
||||
* @功能说明:用户报名列表
|
||||
*/
|
||||
public function recordList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis[] = ['a.uniacid','=',$this->_uniacid];
|
||||
|
||||
if(!empty($input['status'])){
|
||||
|
||||
$dis[] = ['b.atv_status','=',$input['status']];
|
||||
}
|
||||
|
||||
if(!empty($input['pay_type'])){
|
||||
|
||||
$dis[] = ['a.pay_type','=',$input['pay_type']];
|
||||
|
||||
}
|
||||
|
||||
if(!empty($input['start_time'])&&!empty($input['end_time'])){
|
||||
|
||||
$dis[] = ['a.pay_time','between',"{$input['start_time']},{$input['end_time']}"];
|
||||
}
|
||||
|
||||
if(!empty($input['id'])){
|
||||
|
||||
$dis[] = ['a.atv_id','=',$input['id']];
|
||||
}
|
||||
|
||||
$data = $this->record_model->atvRecordList($dis,$input['limit'],[],$input['rank']);
|
||||
|
||||
if(!empty($data['data'])){
|
||||
|
||||
$user_model = new User();
|
||||
|
||||
$driver_model = new CarDriver();
|
||||
|
||||
$page = ($data['current_page']-1)*$data['per_page'];
|
||||
|
||||
foreach ($data['data'] as $k=>&$v){
|
||||
|
||||
$v['nickName'] = $user_model->where(['id'=>$v['user_id']])->value('nickName');
|
||||
|
||||
$v['phone'] = $user_model->where(['id'=>$v['user_id']])->value('phone');
|
||||
|
||||
$v['avatarUrl'] = $user_model->where(['id'=>$v['user_id']])->value('avatarUrl');
|
||||
|
||||
$v['user_name'] = $driver_model->where(['user_id'=>$v['user_id']])->value('user_name');
|
||||
|
||||
// $v['game_info']['top'] = $v['pay_type']==7?$page+$k+1:0;
|
||||
|
||||
$v['game_info']['top'] = $this->record_model->getRecordTop($v);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $this->success($data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-16 15:46
|
||||
* @功能说明:报名详情
|
||||
*/
|
||||
public function recordInfo(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$data['record_info'] = $this->record_model->dataInfo($dis);
|
||||
|
||||
$data['record_info']['create_time'] = date('Y-m-d H:i:s',$data['record_info']['create_time']);
|
||||
|
||||
$atv_model = new CarAtvList();
|
||||
|
||||
$driver_model = new CarDriver();
|
||||
|
||||
$data['atv_info'] = $atv_model->dataInfo(['id'=>$data['record_info']['atv_id']]);
|
||||
|
||||
$user_model = new User();
|
||||
|
||||
$data['record_info']['nickName'] = $user_model->where(['id'=>$data['record_info']['user_id']])->value('nickName');
|
||||
|
||||
$data['record_info']['avatarUrl'] = $user_model->where(['id'=>$data['record_info']['user_id']])->value('avatarUrl');
|
||||
|
||||
$data['record_info']['phone'] = $user_model->where(['id'=>$data['record_info']['user_id']])->value('phone');
|
||||
|
||||
$data['record_info']['user_name'] = $driver_model->where(['user_id'=>$data['record_info']['user_id']])->value('user_name');
|
||||
|
||||
$data['record_info']['game_info']['top'] = $this->record_model->getRecordTop($data['record_info']);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 13:29
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function recordUpdate(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$input['uniacid'] = $this->_uniacid;
|
||||
|
||||
$data = $this->record_model->dataUpdate($dis,$input);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-10-20 10:30
|
||||
* @功能说明:比赛情况列表
|
||||
*/
|
||||
public function gameList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis[] = ['a.uniacid','=',$this->_uniacid];
|
||||
|
||||
$dis[] = ['a.have_game','=',1];
|
||||
|
||||
if(!empty($input['name'])){
|
||||
|
||||
$dis[] = ['b.nickName','like','%'.$input['name'].'%'];
|
||||
|
||||
}
|
||||
|
||||
if(!empty($input['major'])){
|
||||
|
||||
$dis[] = ['a.major','=',$input['major']];
|
||||
}
|
||||
|
||||
if(!empty($input['start_time'])){
|
||||
|
||||
$dis[] = ['a.start_time','between',"{$input['start_time']},{$input['end_time']}"];
|
||||
}
|
||||
|
||||
$game_model = new CarGame();
|
||||
|
||||
$data = $game_model->topRecordList($dis,$input['limit']);
|
||||
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
203
app/massage/controller/AdminBalance.php
Normal file
203
app/massage/controller/AdminBalance.php
Normal file
@@ -0,0 +1,203 @@
|
||||
<?php
|
||||
namespace app\massage\controller;
|
||||
use app\AdminRest;
|
||||
use app\massage\model\BalanceCard;
|
||||
use app\massage\model\BalanceOrder;
|
||||
use app\massage\model\Coupon;
|
||||
use app\shop\model\Article;
|
||||
use app\shop\model\Banner;
|
||||
use app\shop\model\Cap;
|
||||
use app\shop\model\Date;
|
||||
use app\shop\model\MsgConfig;
|
||||
use app\shop\model\OrderAddress;
|
||||
use app\shop\model\OrderGoods;
|
||||
use app\shop\model\RefundOrder;
|
||||
use app\shop\model\RefundOrderGoods;
|
||||
use app\shop\model\Wallet;
|
||||
use think\App;
|
||||
use app\shop\model\Order as Model;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
class AdminBalance extends AdminRest
|
||||
{
|
||||
|
||||
|
||||
protected $model;
|
||||
|
||||
protected $order_model;
|
||||
|
||||
protected $refund_order_model;
|
||||
|
||||
public function __construct(App $app) {
|
||||
|
||||
parent::__construct($app);
|
||||
|
||||
$this->model = new BalanceCard();
|
||||
|
||||
$this->order_model = new BalanceOrder();
|
||||
|
||||
$this->refund_order_model = new RefundOrder();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-04 19:09
|
||||
* @功能说明:储值充值卡列表
|
||||
*/
|
||||
public function cardList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis[] = ['uniacid','=',$this->_uniacid];
|
||||
|
||||
$dis[] = ['status','>',-1];
|
||||
|
||||
if(!empty($input['name'])){
|
||||
|
||||
$dis[] = ['title','like','%'.$input['name'].'%'];
|
||||
|
||||
}
|
||||
|
||||
$data = $this->model->dataList($dis,$input['limit']);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-04 18:56
|
||||
* @功能说明:添加充值卡
|
||||
*/
|
||||
public function cardAdd(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$input['uniacid'] = $this->_uniacid;
|
||||
|
||||
$res = $this->model->dataAdd($input);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-04 18:57
|
||||
* @功能说明:编辑充值卡
|
||||
*/
|
||||
public function cardUpdate(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$res = $this->model->dataUpdate($dis,$input);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-04 18:59
|
||||
* @功能说明:充值卡详情
|
||||
*/
|
||||
public function cardInfo(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$res = $this->model->dataInfo($dis);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-04 19:09
|
||||
* @功能说明:储值订单列表
|
||||
*/
|
||||
public function orderList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis[] = ['uniacid','=',$this->_uniacid];
|
||||
|
||||
$dis[] = ['status','>',1];
|
||||
|
||||
if(!empty($input['name'])){
|
||||
|
||||
$dis[] = ['title','like','%'.$input['name'].'%'];
|
||||
|
||||
}
|
||||
|
||||
if(!empty($input['order_code'])){
|
||||
|
||||
$dis[] = ['order_code','like','%'.$input['order_code'].'%'];
|
||||
|
||||
}
|
||||
|
||||
if(!empty($input['start_time'])){
|
||||
|
||||
$dis[] = ['pay_time','between',"{$input['start_time']},{$input['end_time']}"];
|
||||
|
||||
}
|
||||
|
||||
$data = $this->order_model->dataList($dis,$input['limit']);
|
||||
|
||||
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-04 18:59
|
||||
* @功能说明:充值订单详情
|
||||
*/
|
||||
public function orderInfo(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$res = $this->order_model->dataInfo($dis);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
239
app/massage/controller/AdminCoupon.php
Normal file
239
app/massage/controller/AdminCoupon.php
Normal file
@@ -0,0 +1,239 @@
|
||||
<?php
|
||||
namespace app\massage\controller;
|
||||
use app\AdminRest;
|
||||
use app\massage\model\Coupon;
|
||||
use app\massage\model\CouponAtv;
|
||||
use app\massage\model\CouponAtvRecord;
|
||||
use app\massage\model\CouponRecord;
|
||||
use app\shop\model\Article;
|
||||
use app\shop\model\Banner;
|
||||
use app\shop\model\Cap;
|
||||
use app\shop\model\Date;
|
||||
use app\shop\model\MsgConfig;
|
||||
use app\shop\model\OrderAddress;
|
||||
use app\shop\model\OrderGoods;
|
||||
use app\shop\model\RefundOrder;
|
||||
use app\shop\model\RefundOrderGoods;
|
||||
use app\shop\model\Wallet;
|
||||
use think\App;
|
||||
use app\shop\model\Order as Model;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
class AdminCoupon extends AdminRest
|
||||
{
|
||||
|
||||
|
||||
protected $model;
|
||||
|
||||
protected $atv_model;
|
||||
|
||||
protected $record_model;
|
||||
|
||||
public function __construct(App $app) {
|
||||
|
||||
parent::__construct($app);
|
||||
|
||||
$this->model = new Coupon();
|
||||
|
||||
$this->atv_model = new CouponAtv();
|
||||
|
||||
$this->record_model = new CouponRecord();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-04 19:09
|
||||
* @功能说明:优惠券列表
|
||||
*/
|
||||
public function couponList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis[] = ['uniacid','=',$this->_uniacid];
|
||||
|
||||
if(!empty($input['status'])){
|
||||
|
||||
$dis[] = ['status','=',$input['status']];
|
||||
|
||||
}else{
|
||||
|
||||
$dis[] = ['status','>',-1];
|
||||
|
||||
}
|
||||
|
||||
if(isset($input['send_type'])){
|
||||
|
||||
$dis[] = ['send_type','=',$input['send_type']];
|
||||
|
||||
}
|
||||
|
||||
if(!empty($input['name'])){
|
||||
|
||||
$dis[] = ['title','like','%'.$input['name'].'%'];
|
||||
|
||||
}
|
||||
|
||||
$data = $this->model->dataList($dis,$input['limit']);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-04 18:56
|
||||
* @功能说明:添加优惠券
|
||||
*/
|
||||
public function couponAdd(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$input['uniacid'] = $this->_uniacid;
|
||||
|
||||
$res = $this->model->dataAdd($input);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-04 18:57
|
||||
* @功能说明:编辑优惠券
|
||||
*/
|
||||
public function couponUpdate(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
|
||||
$input['uniacid'] = $this->_uniacid;
|
||||
//删除优惠券 需要判断该优惠券是否正在参加活动
|
||||
if(isset($input['status'])&&$input['status']==-1){
|
||||
|
||||
$atv_record_model = new CouponAtvRecord();
|
||||
|
||||
$have_atv = $atv_record_model->couponIsAtv($input['id']);
|
||||
|
||||
if($have_atv==true){
|
||||
|
||||
$this->errorMsg('该优惠券正在参加活动,只有等用户发起等活动结束后才能删除');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$res = $this->model->dataUpdate($dis,$input);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-04 18:59
|
||||
* @功能说明:优惠券详情
|
||||
*/
|
||||
public function couponInfo(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$res = $this->model->dataInfo($dis);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-06 19:19
|
||||
* @功能说明:活动详情
|
||||
*/
|
||||
public function couponAtvInfo(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis = [
|
||||
|
||||
'uniacid' => $this->_uniacid
|
||||
];
|
||||
|
||||
$data = $this->atv_model->dataInfo($dis);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-06 19:22
|
||||
* @功能说明:活动编辑
|
||||
*/
|
||||
public function couponAtvUpdate(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$dis = [
|
||||
|
||||
'uniacid' => $this->_uniacid
|
||||
];
|
||||
|
||||
$input['uniacid'] = $this->_uniacid;
|
||||
|
||||
$data = $this->atv_model->dataUpdate($dis,$input);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-12 16:26
|
||||
* @功能说明:后台派发卡劵
|
||||
*/
|
||||
public function couponRecordAdd(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
foreach ($input['user'] as $value){
|
||||
|
||||
$res = $this->record_model->recordAdd($input['coupon_id'],$value['id'],$value['num']);
|
||||
|
||||
if(!empty($res['code'])){
|
||||
|
||||
$this->errorMsg($res['msg']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
647
app/massage/controller/AdminDriver.php
Normal file
647
app/massage/controller/AdminDriver.php
Normal file
@@ -0,0 +1,647 @@
|
||||
<?php
|
||||
namespace app\massage\controller;
|
||||
use app\AdminRest;
|
||||
use app\massage\model\CarAtvList;
|
||||
use app\massage\model\CarDriver;
|
||||
use app\massage\model\CarTrophy;
|
||||
use app\massage\model\CarType;
|
||||
use app\massage\model\CarUserTrophy;
|
||||
use app\massage\model\Coach;
|
||||
use app\massage\model\CoachLevel;
|
||||
|
||||
use app\massage\model\Goods;
|
||||
use app\massage\model\Order;
|
||||
use app\massage\model\Police;
|
||||
use app\massage\model\User;
|
||||
use app\member\model\Level;
|
||||
use app\restaurant\model\GoodsCate;
|
||||
use app\restaurant\model\GoodsSpe;
|
||||
use app\shop\model\Wallet;
|
||||
use longbingcore\wxcore\PospalApi;
|
||||
use longbingcore\wxcore\WxPay;
|
||||
use think\App;
|
||||
use app\shop\model\Order as Model;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
class AdminDriver extends AdminRest
|
||||
{
|
||||
|
||||
|
||||
protected $model;
|
||||
|
||||
protected $order_goods_model;
|
||||
|
||||
protected $trophy_model;
|
||||
|
||||
protected $car_type_model;
|
||||
|
||||
public function __construct(App $app) {
|
||||
|
||||
parent::__construct($app);
|
||||
|
||||
$this->model = new CarDriver();
|
||||
|
||||
$this->car_type_model = new CarType();
|
||||
//
|
||||
$this->trophy_model = new CarTrophy();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-15 14:43
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function driverList(){
|
||||
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis[] = ['a.uniacid','=',$this->_uniacid];
|
||||
|
||||
if(!empty($input['status'])){
|
||||
|
||||
$dis[] = ['a.status','=',$input['status']];
|
||||
|
||||
}else{
|
||||
|
||||
$dis[] = ['a.status','>',-1];
|
||||
|
||||
}
|
||||
|
||||
if(!empty($input['start_time'])&&!empty($input['end_time'])){
|
||||
|
||||
$start_time = $input['start_time'];
|
||||
|
||||
$end_time = $input['end_time'];
|
||||
|
||||
$dis[] = ['a.create_time','between',"$start_time,$end_time"];
|
||||
|
||||
}
|
||||
|
||||
$where = [];
|
||||
|
||||
if(!empty($input['name'])){
|
||||
|
||||
$where[] = ['user_name','like','%'.$input['name'].'%'];
|
||||
|
||||
$where[] = ['mobile','like','%'.$input['name'].'%'];
|
||||
}
|
||||
|
||||
$data = $this->model->dataList($dis,$input['limit'],$where);
|
||||
|
||||
$list = [
|
||||
|
||||
'0'=>'all',
|
||||
|
||||
1=>'ing',
|
||||
|
||||
2=>'pass',
|
||||
|
||||
4=>'nopass'
|
||||
];
|
||||
|
||||
foreach ($list as $k=> $value){
|
||||
|
||||
$dis_s = [];
|
||||
|
||||
$dis_s[] =['uniacid','=',$this->_uniacid];
|
||||
|
||||
if(!empty($k)){
|
||||
|
||||
$dis_s[] = ['status','=',$k];
|
||||
|
||||
}else{
|
||||
|
||||
$dis_s[] = ['status','>',-1];
|
||||
|
||||
}
|
||||
|
||||
$data[$value] = $this->model->where($dis_s)->count();
|
||||
|
||||
}
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-15 14:58
|
||||
* @功能说明:车手详情
|
||||
*/
|
||||
public function driverInfo(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$data = $this->model->dataInfo($dis);
|
||||
|
||||
$user_model = new User();
|
||||
|
||||
$data['nickName'] = $user_model->where(['id'=>$data['user_id']])->value('nickName');
|
||||
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-03 00:15
|
||||
* @功能说明:审核(2通过,3取消,4拒绝)
|
||||
*/
|
||||
public function driverUpdate(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
if(!empty($input['status'])&&in_array($input['status'],[2,4])){
|
||||
|
||||
$input['sh_time'] = time();
|
||||
}
|
||||
|
||||
$data = $this->model->dataUpdate($dis,$input);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-04 18:53
|
||||
* @功能说明:奖杯列表
|
||||
*/
|
||||
public function trophyList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis[] = ['uniacid','=',$this->_uniacid];
|
||||
|
||||
$dis[] = ['status','>',-1];
|
||||
|
||||
$data = $this->trophy_model->dataList($dis,$input['limit']);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-04 18:53
|
||||
* @功能说明:奖杯列表
|
||||
*/
|
||||
public function trophySelect(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis[] = ['uniacid','=',$this->_uniacid];
|
||||
|
||||
$dis[] = ['status','=',1];
|
||||
|
||||
if(!empty($input['user_id'])){
|
||||
|
||||
$user_t_model = new CarUserTrophy();
|
||||
|
||||
$id = $user_t_model->where(['user_id'=>$input['user_id']])->column('trophy_id');
|
||||
|
||||
$dis[] = ['id','in',$id];
|
||||
}
|
||||
|
||||
$data = $this->trophy_model->where($dis)->select()->toArray();
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-04 18:56
|
||||
* @功能说明:添加奖杯
|
||||
*/
|
||||
public function trophyAdd(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$input['uniacid'] = $this->_uniacid;
|
||||
|
||||
$res = $this->trophy_model->dataAdd($input);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-04 18:57
|
||||
* @功能说明:编辑奖杯
|
||||
*/
|
||||
public function trophyUpdate(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$res = $this->trophy_model->dataUpdate($dis,$input);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-04 18:59
|
||||
* @功能说明:奖杯详情
|
||||
*/
|
||||
public function trophyInfo(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$res = $this->trophy_model->dataInfo($dis);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-04 18:53
|
||||
* @功能说明:车型列表
|
||||
*/
|
||||
public function cartypeSelect(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis[] = ['uniacid','=',$this->_uniacid];
|
||||
|
||||
$dis[] = ['status','=',1];
|
||||
|
||||
$data = $this->car_type_model->where($dis)->select()->toArray();
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-04 18:53
|
||||
* @功能说明:车型列表
|
||||
*/
|
||||
public function cartypeList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis[] = ['uniacid','=',$this->_uniacid];
|
||||
|
||||
$dis[] = ['status','>',-1];
|
||||
|
||||
if(!empty($input['title'])){
|
||||
|
||||
$dis[] = ['title','like','%'.$input['title'].'%'];
|
||||
}
|
||||
|
||||
$data = $this->car_type_model->dataList($dis,$input['limit']);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-04 18:56
|
||||
* @功能说明:添加车型
|
||||
*/
|
||||
public function cartypeAdd(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$input['uniacid'] = $this->_uniacid;
|
||||
|
||||
$res = $this->car_type_model->dataAdd($input);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-04 18:57
|
||||
* @功能说明:编辑车型
|
||||
*/
|
||||
public function cartypeUpdate(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
//删除
|
||||
if(isset($input['status'])&&in_array($input['status'],[-1,0])){
|
||||
|
||||
$goods_model = new Goods();
|
||||
|
||||
$goods = $goods_model->carTypeHave($input['id']);
|
||||
|
||||
if(!empty($goods)){
|
||||
|
||||
$this->errorMsg('产品:'.$goods['title'].' 正在使用该车型,无法删除或下架');
|
||||
}
|
||||
|
||||
$atv_model = new CarAtvList();
|
||||
|
||||
$atv = $atv_model->where(['car_type_id'=>$input['id']])->where('status','>',-1)->find();
|
||||
|
||||
if(!empty($atv)){
|
||||
|
||||
$atv = $atv->toArray();
|
||||
|
||||
$this->errorMsg('活动:'.$atv['title'].' 正在使用该车型,无法删除或下架');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$res = $this->car_type_model->dataUpdate($dis,$input);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-04 18:59
|
||||
* @功能说明:车型详情
|
||||
*/
|
||||
public function cartypeInfo(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$res = $this->car_type_model->dataInfo($dis);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-07 18:46
|
||||
* @功能说明:提现列表
|
||||
*/
|
||||
public function walletList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis[] = ['a.uniacid','=',$this->_uniacid];
|
||||
|
||||
$dis[] = ['a.type','=',$input['type']];
|
||||
|
||||
if(!empty($input['code'])){
|
||||
|
||||
$dis[] = ['a.code','like','%'.$input['code'].'%'];
|
||||
}
|
||||
|
||||
if(!empty($input['status'])){
|
||||
|
||||
$dis[] = ['a.status','=',$input['status']];
|
||||
}
|
||||
|
||||
$data = $this->wallet_model->adminList($dis,$input['limit']);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-07 18:57
|
||||
* @功能说明:提现详情
|
||||
*/
|
||||
public function walletInfo(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$data = $this->wallet_model->dataInfo($dis);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-07 18:58
|
||||
* @功能说明:通过提现申请
|
||||
*/
|
||||
public function walletPass(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$data = $this->wallet_model->dataInfo($dis);
|
||||
|
||||
if($data['status']!=1){
|
||||
|
||||
$this->errorMsg('申请已审核');
|
||||
}
|
||||
|
||||
$update = [
|
||||
|
||||
'sh_time' => time(),
|
||||
|
||||
//'text' => !empty($input['text'])?$input['text']:'',
|
||||
|
||||
'status' => 2,
|
||||
|
||||
'online' => $input['online'],
|
||||
|
||||
'true_price'=> $data['apply_price']
|
||||
];
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
$res = $this->wallet_model->dataUpdate(['id'=>$input['id'],'status'=>1],$update);
|
||||
|
||||
if($res!=1){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
$this->errorMsg('打款失败');
|
||||
|
||||
}
|
||||
//线上转账
|
||||
if($input['online']==1){
|
||||
|
||||
$user_model = new \app\massage\model\User();
|
||||
|
||||
$openid = $user_model->where(['id'=>$data['user_id']])->value('openid');
|
||||
|
||||
if(empty($openid)){
|
||||
|
||||
return $this->error('用户信息错误,未获取到openid');
|
||||
}
|
||||
//微信相关模型
|
||||
$wx_pay = new WxPay($this->_uniacid);
|
||||
//微信提现
|
||||
$res = $wx_pay->crteateMchPay($this->payConfig(),$openid,$update['true_price']);
|
||||
|
||||
if($res['result_code']=='SUCCESS'&&$res['return_code']=='SUCCESS'){
|
||||
|
||||
if(!empty($res['payment_no'])){
|
||||
|
||||
$this->wallet_model->dataUpdate(['id'=>$input['id']],['payment_no'=>$res['payment_no']]);
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
Db::rollback();
|
||||
|
||||
return $this->error(!empty($res['err_code_des'])?$res['err_code_des']:'你还未该权限');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-26 15:03
|
||||
* @功能说明:决绝提现
|
||||
*/
|
||||
public function walletNoPass(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$info = $this->wallet_model->dataInfo(['id'=>$input['id']]);
|
||||
|
||||
if($info['status']==2){
|
||||
|
||||
$this->errorMsg('已同意打款');
|
||||
}
|
||||
|
||||
if($info['status']==3){
|
||||
|
||||
$this->errorMsg('已拒绝打款');
|
||||
}
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
|
||||
$update = [
|
||||
|
||||
'sh_time' => time(),
|
||||
|
||||
//'text' => !empty($input['text'])?$input['text']:'',
|
||||
|
||||
'status' => 3,
|
||||
|
||||
];
|
||||
|
||||
$res = $this->wallet_model->dataUpdate(['id'=>$input['id'],'status'=>1],$update);
|
||||
|
||||
if($res!=1){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
$this->errorMsg('打款失败');
|
||||
|
||||
}
|
||||
|
||||
$cap_info = $this->model->dataInfo(['id'=>$info['coach_id']]);
|
||||
|
||||
if($info['type']==1){
|
||||
|
||||
$res = $this->model->dataUpdate(['id'=>$info['coach_id']],['service_price'=>$cap_info['service_price']+$info['total_price']]);
|
||||
}else{
|
||||
|
||||
$res = $this->model->dataUpdate(['id'=>$info['coach_id']],['car_price'=>$cap_info['car_price']+$info['total_price']]);
|
||||
|
||||
}
|
||||
|
||||
if($res!=1){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
$this->errorMsg('审核失败');
|
||||
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
287
app/massage/controller/AdminExcel.php
Normal file
287
app/massage/controller/AdminExcel.php
Normal file
@@ -0,0 +1,287 @@
|
||||
<?php
|
||||
namespace app\massage\controller;
|
||||
use app\AdminRest;
|
||||
use app\massage\model\Article;
|
||||
|
||||
use app\massage\model\Cap;
|
||||
use app\massage\model\Date;
|
||||
|
||||
use app\massage\model\OrderGoods;
|
||||
use app\massage\model\RefundOrder;
|
||||
use app\massage\model\Wallet;
|
||||
use longbingcore\wxcore\Excel;
|
||||
use think\App;
|
||||
use app\massage\model\Order as Model;
|
||||
|
||||
|
||||
class AdminExcel extends AdminRest
|
||||
{
|
||||
|
||||
|
||||
protected $model;
|
||||
|
||||
protected $order_goods_model;
|
||||
|
||||
protected $refund_order_model;
|
||||
|
||||
public function __construct(App $app) {
|
||||
|
||||
parent::__construct($app);
|
||||
|
||||
$this->model = new Model();
|
||||
|
||||
$this->order_goods_model = new OrderGoods();
|
||||
|
||||
$this->refund_order_model = new RefundOrder();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-15 14:43
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function orderList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis[] = ['a.uniacid','=',$this->_uniacid];
|
||||
//时间搜素
|
||||
if(!empty($input['start_time'])&&!empty($input['end_time'])){
|
||||
|
||||
$start_time = $input['start_time'];
|
||||
|
||||
$end_time = $input['end_time'];
|
||||
|
||||
$dis[] = ['a.create_time','between',"$start_time,$end_time"];
|
||||
}
|
||||
//商品名字搜索
|
||||
if(!empty($input['goods_name'])){
|
||||
|
||||
$dis[] = ['b.goods_name','like','%'.$input['goods_name'].'%'];
|
||||
}
|
||||
//手机号搜索
|
||||
if(!empty($input['mobile'])){
|
||||
|
||||
$dis[] = ['a.mobile','like','%'.$input['mobile'].'%'];
|
||||
}
|
||||
|
||||
if(!empty($input['pay_type'])){
|
||||
//订单状态搜索
|
||||
$dis[] = ['a.pay_type','=',$input['pay_type']];
|
||||
|
||||
}
|
||||
//除开删除的
|
||||
$dis[] = ['a.is_show','=',1];
|
||||
|
||||
if(!empty($input['order_code'])){
|
||||
|
||||
$dis[] = ['a.order_code','like','%'.$input['order_code'].'%'];
|
||||
}
|
||||
|
||||
$data = $this->model->adminDataSelect($dis,$input['limit']);
|
||||
|
||||
$name = '订单列表';
|
||||
|
||||
$header=[
|
||||
'订单ID',
|
||||
'产品',
|
||||
'产品价格',
|
||||
'数量',
|
||||
'下单人',
|
||||
'手机号',
|
||||
// '服务项目费用',
|
||||
'实收金额',
|
||||
'系统订单号',
|
||||
'付款订单号',
|
||||
'下单时间',
|
||||
'支付方式',
|
||||
'状态',
|
||||
];
|
||||
|
||||
$new_data = [];
|
||||
|
||||
foreach ($data as $v){
|
||||
|
||||
$info = array();
|
||||
|
||||
$info[] = $v['id'];
|
||||
|
||||
$info[] = $v['goods_name'];
|
||||
|
||||
$info[] = $v['goods_price'];
|
||||
|
||||
$info[] = $v['num'];
|
||||
|
||||
$info[] = $v['nickName'];
|
||||
|
||||
$info[] = $v['mobile'];
|
||||
|
||||
// $info[] = $v['init_service_price'];
|
||||
|
||||
$info[] = $v['pay_price'];
|
||||
|
||||
$info[] = $v['order_code'];
|
||||
|
||||
$info[] = $v['transaction_id'];
|
||||
|
||||
$info[] = date('Y-m-d H:i:s',$v['create_time']);
|
||||
|
||||
$info[] = !empty($v['balance'])?'余额支付':'微信支付';
|
||||
|
||||
$info[] = $this->orderStatusText($v['pay_type']);
|
||||
|
||||
$new_data[] = $info;
|
||||
}
|
||||
|
||||
$excel = new Excel();
|
||||
|
||||
$excel->excelExport($name,$header,$new_data,'',1);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-30 16:32
|
||||
* @功能说明:
|
||||
*/
|
||||
public function orderStatusText($status){
|
||||
|
||||
switch ($status){
|
||||
|
||||
case 1:
|
||||
return '待支付';
|
||||
|
||||
break;
|
||||
case 2:
|
||||
return '待签到';
|
||||
|
||||
break;
|
||||
case 3:
|
||||
return '待核销';
|
||||
|
||||
break;
|
||||
case 7:
|
||||
return '已完成';
|
||||
|
||||
break;
|
||||
case -1:
|
||||
return '已取消';
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-18 13:37
|
||||
* @功能说明:财务数据统计导出
|
||||
*/
|
||||
public function dateCount(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$cap_id = $input['cap_id'];
|
||||
|
||||
$date_model = new Date();
|
||||
|
||||
$wallet_model = new Wallet();
|
||||
|
||||
$cap_model = new Cap();
|
||||
|
||||
$date_model->dataInit($this->_uniacid);
|
||||
|
||||
$dis[] = ['uniacid','=',$this->_uniacid];
|
||||
//时间搜素
|
||||
if(!empty($input['start_time'])&&!empty($input['end_time'])){
|
||||
|
||||
$start_time = $input['start_time'];
|
||||
|
||||
$end_time = $input['end_time'];
|
||||
|
||||
$dis[] = ['date_str','between',"$start_time,$end_time"];
|
||||
}
|
||||
|
||||
$date_list = $date_model->dataList($dis,100000);
|
||||
//店铺名字
|
||||
$store_name = $cap_model->where(['id'=>$cap_id])->value('store_name');
|
||||
//开始时间结束时间
|
||||
if(!empty($start_time)){
|
||||
|
||||
$date_list['start_time'] = $start_time;
|
||||
|
||||
$date_list['end_time'] = $end_time;
|
||||
|
||||
}else{
|
||||
|
||||
$date_list['start_time'] = $date_model->where(['uniacid'=>$this->_uniacid])->min('date_str');
|
||||
|
||||
$date_list['end_time'] = $date_model->where(['uniacid'=>$this->_uniacid])->max('date_str');
|
||||
|
||||
}
|
||||
|
||||
if(!empty($date_list['data'])){
|
||||
|
||||
foreach ($date_list['data'] as $k=>$v){
|
||||
//订单金额
|
||||
$date_list['data'][$k]['order_price'] = $this->model->datePrice($v['date_str'],$this->_uniacid,$cap_id);
|
||||
//退款金额
|
||||
$date_list['data'][$k]['refund_price'] = $this->refund_order_model->datePrice($v['date_str'],$this->_uniacid,$cap_id);
|
||||
//提现金额
|
||||
$date_list['data'][$k]['wallet_price'] = $wallet_model->datePrice($v['date_str'],$this->_uniacid,$cap_id);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$name = $store_name.'财务报表';
|
||||
|
||||
$header=[
|
||||
'收支时间',
|
||||
'订单收入',
|
||||
'订单退款',
|
||||
'提现(元)',
|
||||
];
|
||||
|
||||
$new_data = [];
|
||||
|
||||
foreach ($date_list['data'] as $v){
|
||||
|
||||
$info = array();
|
||||
|
||||
$info[] = $v['date'];
|
||||
|
||||
$info[] = $v['order_price'];
|
||||
|
||||
$info[] = $v['refund_price'];
|
||||
|
||||
$info[] = $v['wallet_price'];
|
||||
|
||||
$new_data[] = $info;
|
||||
}
|
||||
|
||||
$excel = new Excel();
|
||||
|
||||
$excel->excelExport($name,$header,$new_data);
|
||||
|
||||
return $this->success($date_list);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
629
app/massage/controller/AdminOrder.php
Normal file
629
app/massage/controller/AdminOrder.php
Normal file
@@ -0,0 +1,629 @@
|
||||
<?php
|
||||
namespace app\massage\controller;
|
||||
use app\AdminRest;
|
||||
use app\massage\model\CarAtvRecord;
|
||||
use app\massage\model\Comment;
|
||||
use app\massage\model\CommentLable;
|
||||
use app\massage\model\Lable;
|
||||
use app\massage\model\NoticeList;
|
||||
use app\massage\model\Order;
|
||||
|
||||
use app\massage\model\Printer;
|
||||
use app\massage\model\RefundOrder;
|
||||
use app\massage\model\User;
|
||||
use app\shop\model\OrderGoods;
|
||||
|
||||
use app\shop\model\Wallet;
|
||||
use think\App;
|
||||
use app\shop\model\Order as Model;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
class AdminOrder extends AdminRest
|
||||
{
|
||||
|
||||
|
||||
protected $model;
|
||||
|
||||
protected $order_goods_model;
|
||||
|
||||
protected $refund_order_model;
|
||||
|
||||
protected $comment_model;
|
||||
|
||||
public function __construct(App $app) {
|
||||
|
||||
parent::__construct($app);
|
||||
|
||||
$this->model = new Order();
|
||||
|
||||
$this->order_goods_model = new OrderGoods();
|
||||
|
||||
$this->refund_order_model = new RefundOrder();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-15 14:43
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function orderList(){
|
||||
|
||||
|
||||
$input = $this->_param;
|
||||
//超时自动取消订单
|
||||
// $this->model->autoCancelOrder($this->_uniacid);
|
||||
|
||||
$dis[] = ['a.uniacid','=',$this->_uniacid];
|
||||
|
||||
//时间搜素
|
||||
if(!empty($input['start_time'])&&!empty($input['end_time'])){
|
||||
|
||||
$start_time = $input['start_time'];
|
||||
|
||||
$end_time = $input['end_time'];
|
||||
|
||||
$dis[] = ['a.create_time','between',"$start_time,$end_time"];
|
||||
}
|
||||
//商品名字搜索
|
||||
if(!empty($input['goods_name'])){
|
||||
|
||||
$dis[] = ['b.goods_name','like','%'.$input['goods_name'].'%'];
|
||||
}
|
||||
|
||||
//手机号搜索
|
||||
if(!empty($input['mobile'])){
|
||||
|
||||
$dis[] = ['a.mobile','like','%'.$input['mobile'].'%'];
|
||||
}
|
||||
|
||||
if(!empty($input['pay_type'])){
|
||||
//订单状态搜索
|
||||
$dis[] = ['a.pay_type','=',$input['pay_type']];
|
||||
|
||||
}
|
||||
// //除开删除的
|
||||
$dis[] = ['a.is_show','=',1];
|
||||
|
||||
|
||||
if(!empty($input['order_code'])){
|
||||
|
||||
$dis[] = ['a.order_code','like','%'.$input['order_code'].'%'];
|
||||
}
|
||||
|
||||
$data = $this->model->adminDataList($dis,$input['limit']);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-15 14:58
|
||||
* @功能说明:订单详情
|
||||
*/
|
||||
public function orderInfo(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$data = $this->model->dataInfo($dis);
|
||||
|
||||
$user_model = new User();
|
||||
|
||||
$data['nickName'] = $user_model->where(['id'=>$data['user_id']])->value('nickName');
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-19 17:50
|
||||
* @功能说明:退款订单详情
|
||||
*/
|
||||
public function refundOrderInfo(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$data = $this->refund_order_model->dataInfo($dis);
|
||||
|
||||
$data['pay_order_code'] = $this->model->where(['id'=>$data['order_id']])->value('order_code');
|
||||
|
||||
$data['create_time'] = date('Y-m-d H:i:s',$data['create_time']);
|
||||
|
||||
$data['refund_time'] = date('Y-m-d H:i:s',$data['refund_time']);
|
||||
|
||||
$user_model = new User();
|
||||
|
||||
$data['nickName'] = $user_model->where(['id'=>$data['user_id']])->value('nickName');
|
||||
|
||||
$data['mobile'] = $this->model->where(['id'=>$data['order_id']])->value('mobile');
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-17 17:44
|
||||
* @功能说明:退款订单列表
|
||||
*/
|
||||
public function refundOrderList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis[] = ['a.uniacid','=',$this->_uniacid];
|
||||
|
||||
//商品名字搜索
|
||||
if(!empty($input['goods_name'])){
|
||||
|
||||
$dis[] = ['c.goods_name','like','%'.$input['goods_name'].'%'];
|
||||
}
|
||||
//订单状态搜索
|
||||
if(!empty($input['status'])){
|
||||
|
||||
$dis[] = ['a.status','=',$input['status']];
|
||||
|
||||
}else{
|
||||
|
||||
$dis[] = ['a.status','>',-1];
|
||||
|
||||
}
|
||||
|
||||
$where = [];
|
||||
|
||||
if(!empty($input['order_code'])){
|
||||
|
||||
$where[] = ['a.order_code','like','%'.$input['order_code'].'%'];
|
||||
|
||||
$where[] = ['d.order_code','like','%'.$input['order_code'].'%'];
|
||||
}
|
||||
|
||||
$data = $this->refund_order_model->adminDataList($dis,$input['limit'],$where);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-18 09:21
|
||||
* @功能说明:拒绝退款
|
||||
*/
|
||||
public function noPassRefund(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$res = $this->refund_order_model->noPassRefund($input['id']);
|
||||
|
||||
if(!empty($res['code'])){
|
||||
|
||||
$this->errorMsg($res['msg']);
|
||||
}
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**\
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-18 09:28
|
||||
* @功能说明:同意退款
|
||||
*/
|
||||
public function passRefund(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$res = $this->refund_order_model->passOrder($input['id'],$input['price'],$this->payConfig(),0,$input['text']);
|
||||
|
||||
if(!empty($res['code'])){
|
||||
|
||||
$this->errorMsg($res['msg']);
|
||||
}
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-05 23:16
|
||||
* @功能说明:评价列表
|
||||
*/
|
||||
public function commentList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
|
||||
$dis[] = ['a.uniacid','=',$this->_uniacid];
|
||||
|
||||
$dis[] = ['a.status','>',-1];
|
||||
|
||||
if(!empty($input['star'])){
|
||||
|
||||
$dis[] = ['a.star','=',$input['star']];
|
||||
}
|
||||
|
||||
if(!empty($input['coach_name'])){
|
||||
|
||||
$dis[] = ['d.coach_name','like','%'.$input['coach_name'].'%'];
|
||||
}
|
||||
|
||||
if(!empty($input['goods_name'])){
|
||||
|
||||
$dis[] = ['c.goods_name','like','%'.$input['goods_name'].'%'];
|
||||
|
||||
}
|
||||
|
||||
$data = $this->comment_model->dataList($dis,$input['limit']);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-05 23:31
|
||||
* @功能说明:编辑评价
|
||||
*/
|
||||
public function commentUpdate(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$data = $this->comment_model->dataUpdate($dis,$input);
|
||||
|
||||
return $this->success($data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-04 18:53
|
||||
* @功能说明:评价标签列表
|
||||
*/
|
||||
public function commentLableList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$lable_model = new Lable();
|
||||
|
||||
$dis[] = ['uniacid','=',$this->_uniacid];
|
||||
|
||||
$dis[] = ['status','>',-1];
|
||||
|
||||
$data = $lable_model->dataList($dis,$input['limit']);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-04 18:56
|
||||
* @功能说明:添加评价标签
|
||||
*/
|
||||
public function commentLableAdd(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$input['uniacid'] = $this->_uniacid;
|
||||
|
||||
$lable_model = new Lable();
|
||||
|
||||
$res = $lable_model->dataAdd($input);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-04 18:57
|
||||
* @功能说明:编辑评价标签
|
||||
*/
|
||||
public function commentLableUpdate(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$lable_model = new Lable();
|
||||
|
||||
$res = $lable_model->dataUpdate($dis,$input);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-04 18:59
|
||||
* @功能说明:评价标签详情
|
||||
*/
|
||||
public function commentLableInfo(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$lable_model = new Lable();
|
||||
|
||||
$res = $lable_model->dataInfo($dis);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-16 10:27
|
||||
* @功能说明:提示列表
|
||||
*/
|
||||
public function noticeList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$notice_model = new NoticeList();
|
||||
|
||||
$dis[] = ['uniacid','=',$this->_uniacid];
|
||||
|
||||
if(!empty($input['type'])){
|
||||
|
||||
$dis[] = ['type','=',$input['type']];
|
||||
}
|
||||
|
||||
if(isset($input['have_look'])){
|
||||
|
||||
$dis[] = ['have_look','=',$input['have_look']];
|
||||
|
||||
}else{
|
||||
|
||||
$dis[] = ['have_look','>',-1];
|
||||
|
||||
}
|
||||
|
||||
if(!empty($input['start_time'])){
|
||||
|
||||
$dis[] = ['create_time','between',"{$input['start_time']},{$input['end_time']}"];
|
||||
}
|
||||
|
||||
$data = $notice_model->dataList($dis,$input['limit']);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-16 10:38
|
||||
* @功能说明:未查看的数量
|
||||
*/
|
||||
public function noLookCount(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis[] = ['uniacid','=',$this->_uniacid];
|
||||
|
||||
$dis[] = ['have_look','=',0];
|
||||
|
||||
$notice_model = new NoticeList();
|
||||
|
||||
$data = $notice_model->where($dis)->count();
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-16 10:41
|
||||
* @功能说明:全部已读
|
||||
*/
|
||||
public function allLook(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis[] = ['uniacid','=',$this->_uniacid];
|
||||
|
||||
$dis[] = ['have_look','=',0];
|
||||
|
||||
$notice_model = new NoticeList();
|
||||
|
||||
$data = $notice_model->dataUpdate($dis,['have_look'=>1]);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-16 10:28
|
||||
* @功能说明:
|
||||
*/
|
||||
public function noticeUpdate(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$notice_model = new NoticeList();
|
||||
|
||||
$data = $notice_model->dataUpdate(['id'=>$input['id']],$input);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-11-11 16:26
|
||||
* @功能说明:订单打印
|
||||
*/
|
||||
public function orderPrinter(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$printer_model = new Printer();
|
||||
|
||||
$res = $printer_model->printer($input['id'],0,$input['type']);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-11-12 15:25
|
||||
* @功能说明:后台数据统计
|
||||
*/
|
||||
public function dataStatistics(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$car_order_model = new Order();
|
||||
|
||||
$record_model = new CarAtvRecord();
|
||||
|
||||
$shop_order_model = new \app\shop\model\Order();
|
||||
|
||||
$restaurant_order_model = new \app\restaurant\model\Order();
|
||||
|
||||
$dis[] =['pay_type','>',1];
|
||||
|
||||
$dis[] =['uniacid','=',$this->_uniacid];
|
||||
|
||||
$car_order_price = $car_order_model->where($dis)->sum('pay_price');
|
||||
|
||||
$record_price = $record_model->where($dis)->sum('pay_price');
|
||||
|
||||
$data['car_price'] = round($car_order_price+$record_price,2);
|
||||
|
||||
$shop_price = $shop_order_model->where($dis)->sum('true_price');
|
||||
|
||||
$restaurant_price = $restaurant_order_model->where($dis)->sum('true_price');
|
||||
|
||||
$data['shop_price'] = round($shop_price,2);
|
||||
|
||||
$data['restaurant_price'] = round($restaurant_price,2);
|
||||
|
||||
$data['all_price'] = round($car_order_price+$record_price+$shop_price+$restaurant_price,2);
|
||||
|
||||
$arr['price'] = $data;
|
||||
|
||||
while ($input['date_start_time']<=$input['date_end_time']){
|
||||
|
||||
$date[] = date('Y-m-d',$input['date_start_time']);
|
||||
|
||||
$input['date_start_time'] +=86400;
|
||||
|
||||
}
|
||||
|
||||
if(!empty($date)){
|
||||
|
||||
foreach ($date as $k=> $value){
|
||||
|
||||
$dis = [];
|
||||
|
||||
$dis[] =['pay_type','>',1];
|
||||
|
||||
$dis[] =['uniacid','=',$this->_uniacid];
|
||||
|
||||
$car_order_price = $car_order_model->where($dis)->whereDay('pay_time',$value)->sum('pay_price');
|
||||
|
||||
$record_price = $record_model->where($dis)->whereDay('pay_time',$value)->sum('pay_price');
|
||||
|
||||
$arr['date'][$k]['car_price']= round($car_order_price+$record_price,2);
|
||||
|
||||
$shop_price = $shop_order_model->where($dis)->whereDay('pay_time',$value)->sum('true_price');
|
||||
|
||||
$restaurant_price = $restaurant_order_model->where($dis)->whereDay('pay_time',$value)->sum('true_price');
|
||||
|
||||
$arr['date'][$k]['shop_price'] = round($shop_price,2);
|
||||
|
||||
$arr['date'][$k]['restaurant_price'] = round($restaurant_price,2);
|
||||
|
||||
$arr['date'][$k]['all_price'] = round($car_order_price+$record_price+$shop_price+$restaurant_price,2);
|
||||
|
||||
$arr['date'][$k]['date'] = $value;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$arr['date'] = array_values($arr['date']);
|
||||
|
||||
$dis[] =['pay_type','>',1];
|
||||
|
||||
$dis[] =['uniacid','=',$this->_uniacid];
|
||||
|
||||
if(!empty($input['start_time'])){
|
||||
|
||||
$dis[] =['pay_time','between',"{$input['start_time']},{$input['end_time']}"];
|
||||
|
||||
}
|
||||
|
||||
if($input['type']==1){
|
||||
|
||||
$arr['order_list'] = $car_order_model->where($dis)->field('id,order_code,pay_price,pay_time')->order('id desc')->paginate($input['limit'])->toArray();
|
||||
|
||||
}elseif($input['type']==2){
|
||||
|
||||
$arr['order_list'] = $shop_order_model->where($dis)->field('id,order_code,true_price as pay_price,pay_time')->order('id desc')->paginate($input['limit'])->toArray();
|
||||
|
||||
}else{
|
||||
|
||||
$arr['order_list'] = $restaurant_order_model->where($dis)->field('id,order_code,true_price as pay_price,pay_time')->order('id desc')->paginate($input['limit'])->toArray();
|
||||
|
||||
}
|
||||
|
||||
return $this->success($arr);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
120
app/massage/controller/AdminPrinter.php
Normal file
120
app/massage/controller/AdminPrinter.php
Normal file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
namespace app\massage\controller;
|
||||
use app\AdminRest;
|
||||
|
||||
|
||||
use think\App;
|
||||
|
||||
use app\massage\model\Printer as model;
|
||||
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
class AdminPrinter extends AdminRest
|
||||
{
|
||||
|
||||
protected $model;
|
||||
|
||||
public function __construct(App $app) {
|
||||
|
||||
parent::__construct($app);
|
||||
|
||||
$this->model = new Model();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 13:28
|
||||
* @功能说明:详情
|
||||
*/
|
||||
public function printerList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
// $dis = [
|
||||
//
|
||||
// 'uniacid' => $this->_uniacid
|
||||
// ];
|
||||
|
||||
$dis[] = ['uniacid','=',$this->_uniacid];
|
||||
|
||||
$dis[] = ['status','>',-1];
|
||||
|
||||
$data = $this->model->dataList($dis,$input['limit']);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 13:28
|
||||
* @功能说明:详情
|
||||
*/
|
||||
public function printerInfo(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$data = $this->model->dataInfo($dis);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 13:29
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function printerAdd(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$input['uniacid'] = $this->_uniacid;
|
||||
|
||||
$data = $this->model->dataAdd($input);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 13:29
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function printerUpdate(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$data = $this->model->dataUpdate($dis,$input);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
148
app/massage/controller/AdminService.php
Normal file
148
app/massage/controller/AdminService.php
Normal file
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
namespace app\massage\controller;
|
||||
use app\AdminRest;
|
||||
use app\massage\model\Goods;
|
||||
use app\massage\model\Service;
|
||||
use app\shop\model\Article;
|
||||
use app\shop\model\Banner;
|
||||
use app\shop\model\Cap;
|
||||
use app\shop\model\GoodsCate;
|
||||
use app\shop\model\GoodsSh;
|
||||
use app\shop\model\GoodsShList;
|
||||
use think\App;
|
||||
use app\shop\model\Goods as Model;
|
||||
use think\Db;
|
||||
|
||||
|
||||
class AdminService extends AdminRest
|
||||
{
|
||||
|
||||
|
||||
protected $model;
|
||||
|
||||
protected $goods_sh;
|
||||
|
||||
protected $goods_sh_list;
|
||||
|
||||
public function __construct(App $app) {
|
||||
|
||||
parent::__construct($app);
|
||||
|
||||
$this->model = new Goods();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-15 14:43
|
||||
* @功能说明:商品列表
|
||||
*/
|
||||
public function serviceList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis[] = ['uniacid','=',$this->_uniacid];
|
||||
|
||||
if(!empty($input['status'])){
|
||||
|
||||
$dis[] = ['status','=',$input['status']];
|
||||
|
||||
}else{
|
||||
|
||||
$dis[] = ['status','>',-1];
|
||||
|
||||
}
|
||||
|
||||
if(!empty($input['name'])){
|
||||
|
||||
$dis[] = ['title','like','%'.$input['name'].'%'];
|
||||
|
||||
}
|
||||
|
||||
$data = $this->model->dataList($dis,$input['limit']);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-15 14:58
|
||||
* @功能说明:审核详情
|
||||
*/
|
||||
public function serviceInfo(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$data = $this->model->dataInfo($dis);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-03 00:27
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function serviceAdd(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$input['uniacid'] = $this->_uniacid;
|
||||
|
||||
$res = $this->model->dataAdd($input);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-03 00:27
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function serviceUpdate(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$input['uniacid'] = $this->_uniacid;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$res = $this->model->dataUpdate($dis,$input);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
554
app/massage/controller/AdminSetting.php
Normal file
554
app/massage/controller/AdminSetting.php
Normal file
@@ -0,0 +1,554 @@
|
||||
<?php
|
||||
namespace app\massage\controller;
|
||||
use app\AdminRest;
|
||||
use app\massage\model\CarPrice;
|
||||
use app\massage\model\Lable;
|
||||
use app\massage\model\Article;
|
||||
use app\massage\model\Banner;
|
||||
use app\massage\model\MsgConfig;
|
||||
use app\massage\model\PayConfig;
|
||||
use think\App;
|
||||
use app\massage\model\Config as Model;
|
||||
|
||||
|
||||
class AdminSetting extends AdminRest
|
||||
{
|
||||
|
||||
|
||||
protected $model;
|
||||
|
||||
|
||||
public function __construct(App $app) {
|
||||
|
||||
parent::__construct($app);
|
||||
|
||||
$this->model = new Model();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-12 15:04
|
||||
* @功能说明:配置详情
|
||||
*/
|
||||
public function configInfo(){
|
||||
|
||||
|
||||
$dis = [
|
||||
|
||||
'uniacid' => $this->_uniacid
|
||||
];
|
||||
|
||||
$data = $this->model->dataInfo($dis);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-12 16:14
|
||||
* @功能说明:编辑配置
|
||||
*/
|
||||
public function configUpdate(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$dis = [
|
||||
|
||||
'uniacid' => $this->_uniacid
|
||||
];
|
||||
|
||||
$data = $this->model->dataUpdate($dis,$input);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-12 16:15
|
||||
* @功能说明:banner列表
|
||||
*/
|
||||
public function bannerList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis[] = ['uniacid','=',$this->_uniacid];
|
||||
|
||||
$dis[] = ['status','>',-1];
|
||||
|
||||
$banner_model = new Banner();
|
||||
|
||||
$data = $banner_model->dataList($dis,$input['limit']);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-12 16:18
|
||||
* @功能说明:添加banner
|
||||
*/
|
||||
public function bannerAdd(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$input['uniacid'] = $this->_uniacid;
|
||||
|
||||
$banner_model = new Banner();
|
||||
|
||||
$res = $banner_model->dataAdd($input);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-12 16:20
|
||||
* @功能说明:编辑banner
|
||||
*/
|
||||
public function bannerUpdate(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$banner_model = new Banner();
|
||||
|
||||
$res = $banner_model->dataUpdate($dis,$input);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-19 13:27
|
||||
* @功能说明:banner详情
|
||||
*/
|
||||
public function bannerInfo(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$banner_model = new Banner();
|
||||
|
||||
$res = $banner_model->dataInfo($dis);
|
||||
|
||||
return $this->success($res);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-18 10:53
|
||||
* @功能说明:支付配置详情
|
||||
*/
|
||||
public function payConfigInfo(){
|
||||
|
||||
$dis = [
|
||||
|
||||
'uniacid' => $this->_uniacid
|
||||
];
|
||||
|
||||
$pay_model = new PayConfig();
|
||||
|
||||
$data = $pay_model->dataInfo($dis);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-18 10:55
|
||||
* @功能说明:编辑支付配置
|
||||
*/
|
||||
public function payConfigUpdate(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$dis = [
|
||||
|
||||
'uniacid' => $this->_uniacid
|
||||
];
|
||||
|
||||
|
||||
if(isset($input['cert_path'])&&isset($input['key_path'])){
|
||||
|
||||
if(!strstr($input['cert_path'],FILE_UPLOAD_PATH)){
|
||||
|
||||
$input['cert_path'] = FILE_UPLOAD_PATH.$input['cert_path'];
|
||||
|
||||
}
|
||||
if(!strstr($input['key_path'],FILE_UPLOAD_PATH)){
|
||||
|
||||
$input['key_path'] = FILE_UPLOAD_PATH.$input['key_path'];
|
||||
}
|
||||
}
|
||||
|
||||
$pay_model = new PayConfig();
|
||||
|
||||
$data = $pay_model->dataUpdate($dis,$input);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-31 15:16
|
||||
* @功能说明:修改密码
|
||||
*/
|
||||
public function updatePass(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$admin = new \app\shop\model\Admin();
|
||||
|
||||
$update = [
|
||||
|
||||
'passwd' => checkPass($input['pass']),
|
||||
];
|
||||
|
||||
$res = $admin->dataUpdate(['uniacid'=>$this->_uniacid],$update);
|
||||
|
||||
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-12 15:04
|
||||
* @功能说明:配置详情
|
||||
*/
|
||||
public function msgConfigInfo(){
|
||||
|
||||
$msg_model = new MsgConfig();
|
||||
|
||||
$dis = [
|
||||
|
||||
'uniacid' => $this->_uniacid
|
||||
];
|
||||
|
||||
$data = $msg_model->dataInfo($dis);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-12 16:14
|
||||
* @功能说明:编辑配置
|
||||
*/
|
||||
public function msgConfigUpdate(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$msg_model = new MsgConfig();
|
||||
|
||||
$dis = [
|
||||
|
||||
'uniacid' => $this->_uniacid
|
||||
];
|
||||
|
||||
$data = $msg_model->dataUpdate($dis,$input);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-05 23:09
|
||||
* @功能说明:评价标签列表
|
||||
*/
|
||||
public function lableList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis[] = ['uniacid','=',$this->_uniacid];
|
||||
|
||||
$dis[] = ['status','>',-1];
|
||||
|
||||
$lable_model = new Lable();
|
||||
|
||||
$data = $lable_model->dataList($dis,$input['limit']);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-05 23:09
|
||||
* @功能说明:评价标签详情
|
||||
*/
|
||||
public function lableInfo(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$lable_model = new Lable();
|
||||
|
||||
$data = $lable_model->dataInfo($dis);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-05 23:09
|
||||
* @功能说明:添加评价标签
|
||||
*/
|
||||
public function lableAdd(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$input['uniacid'] = $this->_uniacid;
|
||||
|
||||
$lable_model = new Lable();
|
||||
|
||||
$data = $lable_model->dataAdd($input);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-05 23:09
|
||||
* @功能说明:编辑评价标签
|
||||
*/
|
||||
public function lableUpdate(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
|
||||
$lable_model = new Lable();
|
||||
|
||||
$data = $lable_model->dataUpdate($dis,$input);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-16 18:46
|
||||
* @功能说明:车费配置详情
|
||||
*/
|
||||
public function carConfigInfo(){
|
||||
|
||||
$car_model = new CarPrice();
|
||||
|
||||
$dis = [
|
||||
|
||||
'uniacid' => $this->_uniacid
|
||||
];
|
||||
|
||||
$data = $car_model->dataInfo($dis);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-16 18:46
|
||||
* @功能说明:车费配置详情
|
||||
*/
|
||||
public function carConfigUpdate(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$car_model = new CarPrice();
|
||||
|
||||
$dis = [
|
||||
|
||||
'uniacid' => $this->_uniacid
|
||||
];
|
||||
|
||||
$data = $car_model->dataUpdate($dis,$input);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-12 16:27
|
||||
* @功能说明:新闻列表
|
||||
*/
|
||||
public function articleList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$article_model = new Article();
|
||||
|
||||
$dis[] = ['uniacid','=',$this->_uniacid];
|
||||
|
||||
$dis[] = ['status','>',-1];
|
||||
|
||||
if(!empty($input['title'])){
|
||||
|
||||
$dis[] = ['title','like','%'.$input['title'].'%'];
|
||||
}
|
||||
|
||||
if(!empty($input['type'])){
|
||||
|
||||
$dis[] = ['type','=',$input['type']];
|
||||
}
|
||||
|
||||
$data = $article_model->dataList($dis,$input['limit']);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-12 16:37
|
||||
* @功能说明:添加文章
|
||||
*
|
||||
*/
|
||||
public function articleAdd(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$article_model = new Article();
|
||||
|
||||
$input['uniacid'] = $this->_uniacid;
|
||||
|
||||
$res = $article_model->dataAdd($input);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-19 13:35
|
||||
* @功能说明:编辑文章
|
||||
*/
|
||||
public function articleUpdate(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$article_model = new Article();
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$res = $article_model->dataUpdate($dis,$input);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-19 13:35
|
||||
* @功能说明:文章详情
|
||||
*/
|
||||
public function articleInfo(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$article_model = new Article();
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$res = $article_model->dataInfo($dis);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-19 13:50
|
||||
* @功能说明:文章下拉框
|
||||
*/
|
||||
public function articleSelect(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$article_model = new Article();
|
||||
|
||||
$dis = [
|
||||
|
||||
'uniacid' => $this->_uniacid,
|
||||
|
||||
'status' => 1
|
||||
];
|
||||
|
||||
$res = $article_model->where($dis)->field('id,title')->select()->toArray();
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
261
app/massage/controller/AdminUser.php
Normal file
261
app/massage/controller/AdminUser.php
Normal file
@@ -0,0 +1,261 @@
|
||||
<?php
|
||||
namespace app\massage\controller;
|
||||
use app\AdminRest;
|
||||
use app\massage\model\AdminRole;
|
||||
use app\massage\model\CarUserTrophy;
|
||||
use app\massage\model\Commission;
|
||||
use app\shop\model\Article;
|
||||
use app\shop\model\Banner;
|
||||
use app\shop\model\Date;
|
||||
use app\massage\model\OrderGoods;
|
||||
use app\massage\model\RefundOrder;
|
||||
use app\shop\model\IntegralLog;
|
||||
use app\shop\model\Wallet;
|
||||
use think\App;
|
||||
use app\massage\model\User as Model;
|
||||
|
||||
|
||||
class AdminUser extends AdminRest
|
||||
{
|
||||
|
||||
|
||||
protected $model;
|
||||
|
||||
protected $order_goods_model;
|
||||
|
||||
protected $refund_order_model;
|
||||
|
||||
public function __construct(App $app) {
|
||||
|
||||
parent::__construct($app);
|
||||
|
||||
$this->model = new Model();
|
||||
|
||||
$this->order_goods_model = new OrderGoods();
|
||||
|
||||
$this->refund_order_model = new RefundOrder();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-24 10:24
|
||||
* @功能说明:用户列表
|
||||
*/
|
||||
public function userList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis[] = ['uniacid','=',$this->_uniacid];
|
||||
//是否授权
|
||||
if(!empty($input['type'])){
|
||||
|
||||
if($input['type']==1){
|
||||
|
||||
$dis[] = ['nickName','=',''];
|
||||
|
||||
}else{
|
||||
|
||||
$dis[] = ['nickName','<>',''];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(isset($input['role'])){
|
||||
|
||||
$dis[] = ['role','=',$input['role']];
|
||||
}
|
||||
|
||||
$where = [];
|
||||
|
||||
if(!empty($input['nickName'])){
|
||||
|
||||
$where[] = ['nickName','like','%'.$input['nickName'].'%'];
|
||||
|
||||
$where[] = ['phone','like','%'.$input['nickName'].'%'];
|
||||
}
|
||||
|
||||
if(!empty($input['start_time'])&&!empty($input['end_time'])){
|
||||
|
||||
$start_time = $input['start_time'];
|
||||
|
||||
$end_time = $input['end_time'];
|
||||
|
||||
$dis[] = ['create_time','between',"$start_time,$end_time"];
|
||||
}
|
||||
|
||||
$data = $this->model->dataList($dis,$input['limit'],$where);
|
||||
|
||||
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-26 14:39
|
||||
* @功能说明:编辑员工
|
||||
*/
|
||||
public function userUpdate(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$res = $this->model->dataUpdate($dis,$input);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-08-28 23:03
|
||||
* @功能说明:佣金记录
|
||||
*/
|
||||
public function commList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis[] = ['a.uniacid','=',$this->_uniacid];
|
||||
|
||||
|
||||
if(!empty($input['status'])){
|
||||
|
||||
$dis[] = ['a.status','=',$input['status']];
|
||||
}
|
||||
|
||||
if(!empty($input['top_name'])){
|
||||
|
||||
$dis[] = ['c.nickName','like','%'.$input['top_name'].'%'];
|
||||
|
||||
}
|
||||
|
||||
$comm_model = new Commission();
|
||||
|
||||
$data = $comm_model->recordList($dis,$input['limit']);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-26 15:02
|
||||
* @功能说明:用户所有获得的奖杯
|
||||
*/
|
||||
public function userTrophy(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$user_trophy_model = new CarUserTrophy();
|
||||
|
||||
$dis = [
|
||||
|
||||
'a.user_id' => $input['user_id'],
|
||||
|
||||
'a.status' => 1,
|
||||
|
||||
'b.status' => 1
|
||||
|
||||
];
|
||||
|
||||
$data = $user_trophy_model->alias('a')
|
||||
->join('shequshop_car_trophy b','a.trophy_id = b.id')
|
||||
->where($dis)
|
||||
->field('a.*,b.title,b.cover')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-26 15:04
|
||||
* @功能说明:用户添加奖杯
|
||||
*/
|
||||
public function userTrophyAdd(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$user_trophy_model = new CarUserTrophy();
|
||||
|
||||
foreach ($input['user_id'] as $value){
|
||||
|
||||
foreach ($input['trophy_id'] as $v){
|
||||
|
||||
$dis = [
|
||||
|
||||
'user_id' => $value,
|
||||
|
||||
'trophy_id'=> $v,
|
||||
|
||||
'uniacid' => $this->_uniacid
|
||||
];
|
||||
|
||||
$find = $user_trophy_model->where($dis)->where('status','>',-1)->find();
|
||||
//增加
|
||||
if($input['add']==1){
|
||||
|
||||
if(empty($find)){
|
||||
|
||||
$user_trophy_model->dataAdd($dis);
|
||||
}
|
||||
|
||||
}else{
|
||||
//减少
|
||||
if(!empty($find)){
|
||||
|
||||
$user_trophy_model->dataUpdate($dis,['status'=>-1]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $this->success(true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2022-07-20 16:00
|
||||
* @功能说明:修改用户积分
|
||||
*/
|
||||
public function userIntegralUpdate(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$log_model = new IntegralLog();
|
||||
|
||||
$type = $input['integral']>0?12:13;
|
||||
|
||||
$res = $log_model->integralUserAdd($input['user_id'],$input['integral'],$this->_uniacid,2,$type);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
899
app/massage/controller/Index.php
Normal file
899
app/massage/controller/Index.php
Normal file
@@ -0,0 +1,899 @@
|
||||
<?php
|
||||
namespace app\massage\controller;
|
||||
use app\ApiRest;
|
||||
|
||||
use app\massage\model\Article;
|
||||
use app\massage\model\CarAtvContent;
|
||||
use app\massage\model\CarAtvList;
|
||||
use app\massage\model\CarAtvRecord;
|
||||
use app\massage\model\CarDriver;
|
||||
use app\massage\model\CarGame;
|
||||
use app\massage\model\CarType;
|
||||
use app\massage\model\Coach;
|
||||
use app\massage\model\CoachCollect;
|
||||
use app\massage\model\Comment;
|
||||
use app\massage\model\Goods;
|
||||
use app\massage\model\Order;
|
||||
use app\massage\model\Service;
|
||||
use app\Rest;
|
||||
|
||||
|
||||
use app\massage\model\Banner;
|
||||
|
||||
use app\massage\model\Car;
|
||||
use app\massage\model\Config;
|
||||
|
||||
use app\massage\model\User;
|
||||
use think\App;
|
||||
|
||||
use think\facade\Db;
|
||||
use think\Request;
|
||||
|
||||
|
||||
|
||||
class Index extends ApiRest
|
||||
{
|
||||
|
||||
protected $model;
|
||||
|
||||
protected $article_model;
|
||||
|
||||
protected $coach_model;
|
||||
|
||||
protected $banner_model;
|
||||
|
||||
protected $car_model;
|
||||
|
||||
protected $record_model;
|
||||
|
||||
protected $driver_model;
|
||||
|
||||
protected $atv_model;
|
||||
|
||||
protected $game_model;
|
||||
|
||||
|
||||
public function __construct(App $app) {
|
||||
|
||||
parent::__construct($app);
|
||||
|
||||
$this->model = new Goods();
|
||||
|
||||
$this->banner_model = new Banner();
|
||||
|
||||
$this->car_model = new Car();
|
||||
|
||||
$this->game_model = new CarGame();
|
||||
|
||||
$this->record_model = new CarAtvRecord();
|
||||
|
||||
$this->driver_model = new CarDriver();
|
||||
|
||||
$this->atv_model = new CarAtvList();
|
||||
|
||||
$this->atv_model->initAtv();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-23 09:20
|
||||
* @功能说明:首页
|
||||
*/
|
||||
public function index(){
|
||||
|
||||
$dis = [
|
||||
|
||||
'uniacid' => $this->_uniacid,
|
||||
|
||||
'status' => 1
|
||||
];
|
||||
|
||||
$data['banner'] = $this->banner_model->where($dis)->field('id,img,link')->order('top desc,id desc')->select()->toArray();
|
||||
//所有专业车手
|
||||
// $user_id = $this->driver_model->where(['status'=>2])->column('user_id');
|
||||
|
||||
$where[] = ['a.have_game','=',1];
|
||||
|
||||
$where[] = ['a.major','=',1];
|
||||
|
||||
$where[] = ['a.type','=',2];
|
||||
|
||||
$speed_record = $this->game_model->topRecordList($where,3);
|
||||
//普通组车手成绩
|
||||
$data['speed_record'] = $speed_record['data'];
|
||||
|
||||
$atv_dis = [
|
||||
|
||||
'uniacid' => $this->_uniacid,
|
||||
//查询已经结束的
|
||||
'atv_status' => 3,
|
||||
|
||||
'status' => 1
|
||||
];
|
||||
//查询最近的一个结束的活动
|
||||
$atv = $this->atv_model->where($atv_dis)->order('atv_e_time desc')->find();
|
||||
|
||||
if(!empty($atv)){
|
||||
|
||||
$atv = $atv->toArray();
|
||||
|
||||
$i_dis = [
|
||||
|
||||
'a.atv_id' => $atv['id'],
|
||||
|
||||
// 'a.status' => 2
|
||||
];
|
||||
//积分排行榜
|
||||
$data['integral']['record'] = $this->record_model->integralRecordList($i_dis,4);
|
||||
|
||||
$data['integral']['record'] = $data['integral']['record']['data'];
|
||||
//时间
|
||||
$data['integral']['time'] = date('Y.m.d',$atv['atv_s_time']).'-'.date('Y.m.d',$atv['atv_e_time']);
|
||||
|
||||
$data['integral']['atv_id'] = $atv['id'];
|
||||
}
|
||||
|
||||
$atv_diss[] = ['uniacid','=',$this->_uniacid];
|
||||
|
||||
$atv_diss[] = ['status','=',1];
|
||||
|
||||
$atv_diss[] = ['app_s_time','<',time()];
|
||||
|
||||
$atv_diss[] = ['app_e_time','>',time()];
|
||||
|
||||
$data['atv'] = $this->atv_model->where($atv_diss)->order('app_s_time')->find();
|
||||
|
||||
if(!empty($data['atv'])){
|
||||
|
||||
$data['atv'] = $data['atv']->toArray();
|
||||
|
||||
$data['atv']['time'] = date('Y.m.d',$data['atv']['atv_s_time']).'-'.date('Y.m.d',$data['atv']['atv_e_time']);
|
||||
|
||||
}
|
||||
|
||||
$article_model = new Article();
|
||||
|
||||
$arr = [
|
||||
//热点
|
||||
'1' => 'hot_article',
|
||||
//赛事
|
||||
'2' => 'game_article',
|
||||
|
||||
];
|
||||
//获取热点文章和赛事文章
|
||||
foreach ($arr as $k=>$value){
|
||||
|
||||
$dis = [
|
||||
|
||||
'type' => $k,
|
||||
|
||||
'uniacid' => $this->_uniacid,
|
||||
|
||||
'status' => 1
|
||||
];
|
||||
|
||||
$data[$value] = $article_model->where($dis)->order('top desc,id desc')->limit(3)->select()->toArray();
|
||||
|
||||
}
|
||||
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-16 14:31
|
||||
* @功能说明:比赛成绩排行版
|
||||
*/
|
||||
public function resultTopList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis[] = ['a.uniacid','=',$this->_uniacid];
|
||||
|
||||
$dis[] = ['a.have_game','=',1];
|
||||
//1普通组 2专业组
|
||||
$dis[] = ['a.major','=',$input['type']];
|
||||
//预约的不算
|
||||
$dis[] = ['a.type','=',2];
|
||||
|
||||
if(!empty($input['time'])){
|
||||
|
||||
$data = $this->game_model->timeTopRecordList($dis,10,$input['time']);
|
||||
|
||||
}else{
|
||||
|
||||
$data = $this->game_model->topRecordList($dis,10);
|
||||
|
||||
}
|
||||
|
||||
return $this->success($data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-16 14:52
|
||||
* @功能说明:所有已经完成的活动
|
||||
*/
|
||||
public function successAtvList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$atv_dis[] = ['uniacid','=',$this->_uniacid];
|
||||
|
||||
$atv_dis[] = ['status','=',1];
|
||||
|
||||
if(!empty($input['title'])){
|
||||
|
||||
$atv_dis[] = ['title','like','%'.$input['title'].'%'];
|
||||
}
|
||||
|
||||
if(!empty($input['atv_status'])){
|
||||
|
||||
$atv_dis[] = ['atv_status','=',$input['atv_status']];
|
||||
}
|
||||
|
||||
$atv = $this->atv_model->where($atv_dis)->order('atv_s_time ,id desc')->paginate(10)->toArray();
|
||||
|
||||
if(!empty($atv['data'])){
|
||||
|
||||
foreach ($atv['data'] as &$v){
|
||||
|
||||
$v['time'] = date('Y.m.d',$v['atv_s_time']).'-'.date('Y.m.d',$v['atv_e_time']);
|
||||
|
||||
$v['app_status'] = 1;
|
||||
//已经开始
|
||||
if($v['app_s_time']<time()){
|
||||
|
||||
$v['app_status'] = 2;
|
||||
}
|
||||
//已经结束
|
||||
if($v['app_e_time']<time()){
|
||||
|
||||
$v['app_status'] = 3;
|
||||
}
|
||||
//剩余数量
|
||||
$v['surplus_num'] = $v['atv_num']-$v['have_num'] ;
|
||||
|
||||
$v['surplus_num'] = $v['surplus_num']>0?$v['surplus_num']:0;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $this->success($atv);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-28 17:43
|
||||
* @功能说明:赛事积分排行榜
|
||||
*/
|
||||
public function integralRecordList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$where[] = ['a.uniacid','=',$this->_uniacid];
|
||||
|
||||
$where[] = ['a.atv_id','=',$input['atv_id']];
|
||||
//报名记录情况
|
||||
$data = $this->record_model->integralRecordList($where,10);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-16 14:55
|
||||
* @功能说明:活动详情
|
||||
*/
|
||||
|
||||
public function atvInfo(){
|
||||
|
||||
$this->record_model->autoCancelRecord();
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$data = $this->atv_model->dataInfo($dis);
|
||||
//活动时间
|
||||
$data['atv_time'] = date('Y.m.d H:i',$data['atv_s_time']).' - '.date('Y.m.d H:i',$data['atv_e_time']);
|
||||
//报名时间
|
||||
$data['app_time'] = date('Y.m.d H:i',$data['app_s_time']).' - '.date('Y.m.d H:i',$data['app_e_time']);
|
||||
|
||||
$where[] = ['a.uniacid','=',$this->_uniacid];
|
||||
|
||||
$where[] = ['a.atv_id','=',$input['id']];
|
||||
|
||||
$where[] = ['a.pay_type','>',1];
|
||||
//报名记录情况
|
||||
$data['record_list'] = $this->record_model->integralRecordList($where,10);
|
||||
|
||||
$re_where[] = ['atv_id','=',$input['id']];
|
||||
|
||||
$re_where[] = ['user_id','=',$this->getUserId()];
|
||||
|
||||
$re_where[] = ['pay_type','>',0];
|
||||
|
||||
$have_app = $this->record_model->dataInfo($re_where);
|
||||
//自己是否已经报名
|
||||
$data['have_app'] = !empty($have_app)?1:0;
|
||||
//
|
||||
$content_model = new CarAtvContent();
|
||||
//报名内容
|
||||
$data['content_text'] = $content_model->where('id','in',$data['content'])->where(['status'=>1])->select()->toArray();
|
||||
|
||||
$data['app_status'] = 1;
|
||||
//已经开始
|
||||
if($data['app_s_time']<time()){
|
||||
|
||||
$data['app_status'] = 2;
|
||||
}
|
||||
//已经结束
|
||||
if($data['app_e_time']<time()){
|
||||
|
||||
$data['app_status'] = 3;
|
||||
}
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-16 15:01
|
||||
* @功能说明:报名活动
|
||||
*/
|
||||
public function appAtv(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['atv_id'],
|
||||
|
||||
'status' => 1
|
||||
];
|
||||
|
||||
$atv = $this->atv_model->dataInfo($dis);
|
||||
|
||||
if(empty($atv)){
|
||||
|
||||
$this->errorMsg('活动已下架');
|
||||
}
|
||||
//已经报名人数
|
||||
$where[] = ['atv_id','=',$input['atv_id']];
|
||||
//去掉已经删除的
|
||||
$where[] = ['pay_type','>',0];
|
||||
|
||||
$where[] = ['user_id','=',$this->getUserId()];
|
||||
//查询自己有没有报名过
|
||||
$user_num = $this->record_model->where($where)->count();
|
||||
|
||||
if(!empty($user_num)){
|
||||
|
||||
$this->errorMsg('你已报名或有报名订单未支付');
|
||||
|
||||
}
|
||||
//防止并发做了一个简单的锁
|
||||
if($atv['have_num']>=$atv['atv_num']){
|
||||
|
||||
$this->errorMsg('报名人数已满');
|
||||
|
||||
}
|
||||
|
||||
$car_type_model = new CarType();
|
||||
|
||||
$car_type = $car_type_model->dataInfo(['id'=>$atv['car_type_id']]);
|
||||
|
||||
if(empty($car_type)){
|
||||
|
||||
$this->errorMsg('车型不存在');
|
||||
}
|
||||
//查询自己是否是专业车手
|
||||
$is_major = $this->driver_model->dataInfo(['user_id'=>$this->getUserId(),'status'=>2]);
|
||||
|
||||
$is_major = !empty($is_major)?1:0;
|
||||
//判断车手身份
|
||||
if($is_major==1&&$car_type['major']==0){
|
||||
|
||||
$this->errorMsg('只有普通车手才能报名');
|
||||
}
|
||||
//判断车手身份
|
||||
if($is_major==0&&$car_type['norm']==0){
|
||||
|
||||
$this->errorMsg('只有专业车手才能报名');
|
||||
}
|
||||
|
||||
// $config = new Config();
|
||||
//
|
||||
// $member_config_model = new \app\member\model\Config();
|
||||
|
||||
// $member_config = $member_config_model->configInfo(['uniacid'=>$this->_uniacid]);
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
$insert = [
|
||||
|
||||
'uniacid' => $this->_uniacid,
|
||||
|
||||
'user_id' => $this->getUserId(),
|
||||
|
||||
'atv_id' => $input['atv_id'],
|
||||
|
||||
'start_time' => $atv['atv_s_time'],
|
||||
|
||||
'end_time' => $atv['atv_e_time'],
|
||||
|
||||
'content' => $input['content'],
|
||||
|
||||
'order_code' => orderCode(),
|
||||
|
||||
'pay_price' => $atv['pay_price'],
|
||||
|
||||
'balance' => !empty($input['is_balance'])?$atv['pay_price']:0,
|
||||
|
||||
'over_time' => time()+3600,
|
||||
|
||||
'car_type_id'=> $atv['car_type_id'],
|
||||
|
||||
'number' => $atv['number'],
|
||||
//付费获得的积分
|
||||
// 'get_integral'=> empty($input['is_balance'])?floor($atv['pay_price']*$member_config['integral_cash']):0,
|
||||
|
||||
];
|
||||
|
||||
$res = $this->record_model->dataAdd($insert);
|
||||
|
||||
if(empty($res)){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
$this->errorMsg('报名失败,请重试');
|
||||
|
||||
}
|
||||
|
||||
$res = $this->atv_model->dataUpdate(['id'=>$insert['atv_id'],'have_num'=>$atv['have_num']],['have_num'=>$atv['have_num']+1]);
|
||||
|
||||
if(empty($res)){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
$this->errorMsg('报名失败,请重试');
|
||||
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
//0元支付
|
||||
if($insert['pay_price']<=0){
|
||||
|
||||
$this->record_model->dataResult($insert['order_code'],$insert['order_code']);
|
||||
|
||||
return $this->success([]);
|
||||
|
||||
}
|
||||
|
||||
if(!empty($insert['balance'])){
|
||||
|
||||
$user_model = new User();
|
||||
|
||||
$user = $user_model->dataInfo(['id'=>$insert['user_id']]);
|
||||
|
||||
if($user['balance']<$insert['balance']){
|
||||
|
||||
$this->errorMsg('余额不足');
|
||||
}
|
||||
|
||||
$this->record_model->dataResult($insert['order_code'],$insert['order_code']);
|
||||
|
||||
return $this->success([]);
|
||||
|
||||
|
||||
}else{
|
||||
//微信支付
|
||||
$pay_controller = new IndexWxPay($this->app);
|
||||
//支付
|
||||
$jsApiParameters= $pay_controller->createWeixinPay($this->payConfig(),$this->getUserInfo()['openid'],$this->_uniacid,"carAtvApp",['type' => 'carAtvApp' , 'out_trade_no' => $insert['order_code']],$insert['pay_price']);
|
||||
|
||||
$arr['pay_list']= $jsApiParameters;
|
||||
|
||||
// $id = $this->record_model->getLastInsID();
|
||||
|
||||
$arr['record'] = $this->record_model->dataInfo(['order_code'=>$insert['order_code']]);
|
||||
|
||||
return $this->success($arr);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-27 10:25
|
||||
* @功能说明:报名记录重新支付
|
||||
*/
|
||||
public function atvRecordRePay(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$record = $this->record_model->dataInfo(['id'=>$input['record_id']]);
|
||||
|
||||
if($record['pay_type']!=1){
|
||||
|
||||
$this->errorMsg('订单已经失效');
|
||||
}
|
||||
|
||||
if(!empty($record['balance'])){
|
||||
|
||||
$user_model = new User();
|
||||
|
||||
$user = $user_model->dataInfo(['id'=>$record['user_id']]);
|
||||
|
||||
if($user['balance']<$record['balance']){
|
||||
|
||||
$this->errorMsg('余额不足');
|
||||
}
|
||||
|
||||
$this->record_model->dataResult($record['order_code'],$record['order_code']);
|
||||
|
||||
return $this->success([]);
|
||||
|
||||
|
||||
}else{
|
||||
//微信支付
|
||||
$pay_controller = new IndexWxPay($this->app);
|
||||
//支付
|
||||
$jsApiParameters= $pay_controller->createWeixinPay($this->payConfig(),$this->getUserInfo()['openid'],$this->_uniacid,"carAtvApp",['type' => 'carAtvApp' , 'out_trade_no' => $record['order_code']],$record['pay_price']);
|
||||
|
||||
$arr['pay_list']= $jsApiParameters;
|
||||
|
||||
return $this->success($arr);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-16 15:57
|
||||
* @功能说明:文章列表
|
||||
*/
|
||||
public function articleList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$article_model = new Article();
|
||||
|
||||
$dis = [
|
||||
|
||||
'uniacid' => $this->_uniacid,
|
||||
|
||||
'status' => 1
|
||||
];
|
||||
|
||||
if(!empty($input['type'])){
|
||||
|
||||
$dis['type'] = $input['type'];
|
||||
}
|
||||
|
||||
$data = $article_model->dataList($dis);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-16 16:02
|
||||
* @功能说明:文章详情
|
||||
*/
|
||||
public function articleInfo(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$article_model = new Article();
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$data = $article_model->dataInfo($dis);
|
||||
|
||||
$data['create_time'] = date('Y.m.d H:i',$data['create_time']);
|
||||
|
||||
$article_model->dataUpdate(['id'=>$input['id']],['iv'=>$data['iv']+1]);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-23 14:16
|
||||
* @功能说明:获取配置信息
|
||||
*/
|
||||
public function configInfo(){
|
||||
|
||||
$dis = [
|
||||
|
||||
'uniacid' => $this->_uniacid
|
||||
];
|
||||
|
||||
$config_model = new Config();
|
||||
|
||||
$config = $config_model->dataInfo($dis);
|
||||
|
||||
return $this->success($config);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-24 14:07
|
||||
* @功能说明:购物车信息
|
||||
*/
|
||||
public function carInfo(){
|
||||
|
||||
$input = $this->_param;
|
||||
//购物车信息
|
||||
$car_info = $this->car_model->carPriceAndCount($this->getUserId(),1);
|
||||
|
||||
return $this->success($car_info);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-23 09:48
|
||||
* @功能说明:再来一单
|
||||
*/
|
||||
public function onceMoreOrder(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$order_model = new Order();
|
||||
|
||||
$order = $order_model->dataInfo(['id'=>$input['order_id']]);
|
||||
|
||||
$coach = $this->coach_model->dataInfo(['id'=>$order['coach_id']]);
|
||||
|
||||
if($coach['status']!=2||$coach['is_work']==0){
|
||||
|
||||
$this->errorMsg('技师未上班');
|
||||
}
|
||||
//清空购物车
|
||||
$this->car_model->where(['user_id'=>$this->getUserId(),'coach_id'=>$order['coach_id']])->delete();
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
foreach ($order['order_goods'] as $v){
|
||||
|
||||
$ser = $this->model->dataInfo(['id'=>$v['goods_id']]);
|
||||
|
||||
if(empty($ser)||$ser['status']!=1){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
$this->errorMsg('服务已经下架');
|
||||
}
|
||||
|
||||
$dis = [
|
||||
|
||||
'user_id' => $this->getUserId(),
|
||||
|
||||
'uniacid' => $this->_uniacid,
|
||||
|
||||
'coach_id' => $order['coach_id'],
|
||||
|
||||
'service_id'=> $v['goods_id'],
|
||||
|
||||
'num' => $v['num']
|
||||
];
|
||||
|
||||
$res = $this->car_model->dataAdd($dis);
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-24 14:46
|
||||
* @功能说明:添加到购物车
|
||||
*/
|
||||
public function addCar(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$insert = [
|
||||
|
||||
'uniacid' => $this->_uniacid,
|
||||
|
||||
'user_id' => $this->getUserId(),
|
||||
|
||||
'goods_id' => $input['goods_id'],
|
||||
|
||||
];
|
||||
|
||||
$info = $this->car_model->dataInfo($insert);
|
||||
//增加数量
|
||||
if(!empty($info)){
|
||||
|
||||
$res = $this->car_model->dataUpdate(['id'=>$info['id']],['num'=>$info['num']+$input['num']]);
|
||||
|
||||
}else{
|
||||
//添加到购物车
|
||||
$insert['num'] = $input['num'];
|
||||
|
||||
$insert['status'] = 1;
|
||||
|
||||
$res = $this->car_model->dataAdd($insert);
|
||||
|
||||
$id = $this->car_model->getLastInsID();
|
||||
|
||||
return $this->success($id);
|
||||
}
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-24 14:54
|
||||
* @功能说明:删除购物车
|
||||
*/
|
||||
public function delCar(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$info = $this->car_model->dataInfo(['id'=>$input['id']]);
|
||||
//加少数量
|
||||
if($info['num']>$input['num']){
|
||||
|
||||
$res = $this->car_model->dataUpdate(['id'=>$info['id']],['num'=>$info['num']-$input['num']]);
|
||||
|
||||
}else{
|
||||
|
||||
$res = $this->car_model->where(['id'=>$info['id']])->delete();
|
||||
}
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-25 10:39
|
||||
* @功能说明:
|
||||
*/
|
||||
public function carUpdate(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$res = $this->car_model->where('id','in',$input['id'])->update(['status'=>$input['status']]);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-24 14:59
|
||||
* @功能说明:批量删除购物车
|
||||
*/
|
||||
public function delSomeCar(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$dis = [
|
||||
|
||||
'uniacid' => $this->_uniacid,
|
||||
|
||||
'user_id' => $this->getUserId(),
|
||||
|
||||
// 'coach_id'=> $input['coach_id'],
|
||||
|
||||
];
|
||||
|
||||
$res = $this->car_model->where($dis)->delete();
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-05 23:16
|
||||
* @功能说明:评价列表
|
||||
*/
|
||||
public function commentList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis[] = ['a.uniacid','=',$this->_uniacid];
|
||||
|
||||
$dis[] = ['a.status','=',1];
|
||||
|
||||
if(!empty($input['coach_id'])){
|
||||
|
||||
$dis[] = ['d.id','=',$input['coach_id']];
|
||||
}
|
||||
|
||||
if(!empty($input['coach_name'])){
|
||||
|
||||
$dis[] = ['d.coach_name','like','%'.$input['coach_name'].'%'];
|
||||
}
|
||||
|
||||
if(!empty($input['goods_name'])){
|
||||
|
||||
$dis[] = ['c.goods_name','like','%'.$input['goods_name'].'%'];
|
||||
|
||||
}
|
||||
|
||||
$comment_model = new Comment();
|
||||
|
||||
$data = $comment_model->dataList($dis);
|
||||
|
||||
if(!empty($data['data'])){
|
||||
|
||||
foreach ($data['data'] as &$v){
|
||||
|
||||
$v['create_time'] = date('Y-m-d H:i:s',$v['create_time']);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
270
app/massage/controller/IndexBalance.php
Normal file
270
app/massage/controller/IndexBalance.php
Normal file
@@ -0,0 +1,270 @@
|
||||
<?php
|
||||
namespace app\massage\controller;
|
||||
use app\ApiRest;
|
||||
|
||||
use app\massage\model\BalanceCard;
|
||||
use app\massage\model\BalanceOrder;
|
||||
use app\massage\model\BalanceWater;
|
||||
use app\massage\model\Coach;
|
||||
use app\massage\model\User;
|
||||
use app\member\model\Level;
|
||||
use app\Rest;
|
||||
|
||||
|
||||
use think\App;
|
||||
|
||||
use think\Request;
|
||||
|
||||
|
||||
|
||||
class IndexBalance extends ApiRest
|
||||
{
|
||||
|
||||
protected $model;
|
||||
|
||||
protected $article_model;
|
||||
|
||||
protected $coach_model;
|
||||
|
||||
protected $water_model;
|
||||
|
||||
|
||||
public function __construct(App $app) {
|
||||
|
||||
parent::__construct($app);
|
||||
|
||||
$this->model = new BalanceCard();
|
||||
|
||||
$this->balance_order = new BalanceOrder();
|
||||
|
||||
$this->water_model = new BalanceWater();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-04 19:09
|
||||
* @功能说明:储值充值卡列表
|
||||
*/
|
||||
public function cardList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis[] = ['uniacid','=',$this->_uniacid];
|
||||
|
||||
$dis[] = ['status','=',1];
|
||||
|
||||
if(!empty($input['name'])){
|
||||
|
||||
$dis[] = ['title','like','%'.$input['name'].'%'];
|
||||
|
||||
}
|
||||
|
||||
$data = $this->model->dataList($dis,$input['limit']);
|
||||
|
||||
if(!empty($data['data'])){
|
||||
|
||||
$level = new Level();
|
||||
|
||||
foreach ($data['data'] as &$v){
|
||||
|
||||
$v['create_time'] = date('Y-m-d H:i:s',$v['create_time']);
|
||||
|
||||
$v['member_title']= $level->where(['id'=>$v['member_level']])->value('title');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-07 17:00
|
||||
* @功能说明:充值余额
|
||||
*/
|
||||
public function payBalanceOrder(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
if(!empty($input['card_id'])){
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['card_id'],
|
||||
|
||||
'status' => 1
|
||||
];
|
||||
|
||||
$card = $this->model->dataInfo($dis);
|
||||
|
||||
if(empty($card)){
|
||||
|
||||
$this->errorMsg('充值卡已被下架');
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
$card = [
|
||||
|
||||
'price' => $input['price'],
|
||||
|
||||
'true_price' => $input['price'],
|
||||
|
||||
'id' => 0,
|
||||
|
||||
'member_level'=> 0,
|
||||
|
||||
'title' => '自定义金额充值'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
$user_model = new User();
|
||||
|
||||
$level_model= new Level();
|
||||
|
||||
$user = $user_model->dataInfo(['id'=>$this->getUserId()]);
|
||||
|
||||
$user_level_discount = $level_model->where(['id'=>$user['member_level']])->value('discount');
|
||||
|
||||
$user_level_discount = !empty($user_level_discount)?$user_level_discount:0;
|
||||
|
||||
$member_level_dicount= $level_model->where(['id'=>$card['member_level']])->value('discount');
|
||||
|
||||
$member_level_dicount= !empty($member_level_dicount)?$member_level_dicount:0;
|
||||
|
||||
$card['member_level']= $member_level_dicount>$user_level_discount?$card['member_level']:0;
|
||||
|
||||
$insert = [
|
||||
|
||||
'uniacid' => $this->_uniacid,
|
||||
|
||||
'user_id' => $this->getUserId(),
|
||||
|
||||
'order_code' => orderCode(),
|
||||
|
||||
'pay_price' => $card['price'],
|
||||
|
||||
'sale_price' => $card['price'],
|
||||
|
||||
'true_price' => $card['true_price'],
|
||||
|
||||
'card_id' => $card['id'],
|
||||
|
||||
'title' => $card['title'],
|
||||
|
||||
'member_level'=> $card['member_level'],
|
||||
|
||||
'phone' => $input['phone']
|
||||
|
||||
];
|
||||
|
||||
$res = $this->balance_order->dataAdd($insert);
|
||||
|
||||
if($res==0){
|
||||
|
||||
$this->errorMsg('充值失败');
|
||||
|
||||
}
|
||||
//微信支付
|
||||
$pay_controller = new IndexWxPay($this->app);
|
||||
//支付
|
||||
$jsApiParameters= $pay_controller->createWeixinPay($this->payConfig(),$this->getUserInfo()['openid'],$this->_uniacid,"储值",['type' => 'Balance' , 'out_trade_no' => $insert['order_code']],$insert['pay_price']);
|
||||
|
||||
$arr['pay_list']= $jsApiParameters;
|
||||
|
||||
return $this->success($arr);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-07 17:34
|
||||
* @功能说明:充值订单列表
|
||||
*/
|
||||
public function balaceOrder(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis[] = ['status','=',2];
|
||||
|
||||
$dis[] = ['user_id','=',$this->getUserId()];
|
||||
|
||||
if(!empty($input['start_time'])){
|
||||
|
||||
$dis[] = ['pay_time','between',"{$input['start_time']},{$input['end_time']}"];
|
||||
|
||||
}
|
||||
|
||||
$data = $this->balance_order->dataList($dis);
|
||||
|
||||
if(!empty($data['data'])){
|
||||
|
||||
foreach ($data['data'] as &$v){
|
||||
|
||||
$v['create_time'] = date('Y-m-d H:i:s',$v['create_time']);
|
||||
|
||||
$v['pay_time'] = date('Y-m-d H:i:s',$v['pay_time']);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-07 18:00
|
||||
* @功能说明:消费明细
|
||||
*/
|
||||
public function payWater(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis[] = ['user_id','=',$this->getUserId()];
|
||||
|
||||
// $dis[] = ['type','=',2];
|
||||
|
||||
if(!empty($input['start_time'])){
|
||||
|
||||
$dis[] = ['create_time','between',"{$input['start_time']},{$input['end_time']}"];
|
||||
|
||||
}
|
||||
|
||||
$data = $this->water_model->dataList($dis);
|
||||
|
||||
if(!empty($data['data'])){
|
||||
|
||||
foreach ($data['data'] as &$v){
|
||||
|
||||
$v['create_time'] = date('Y-m-d H:i:s',$v['create_time']);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
580
app/massage/controller/IndexCoach.php
Normal file
580
app/massage/controller/IndexCoach.php
Normal file
@@ -0,0 +1,580 @@
|
||||
<?php
|
||||
namespace app\massage\controller;
|
||||
use app\ApiRest;
|
||||
|
||||
use app\massage\model\BalanceWater;
|
||||
use app\massage\model\Coach;
|
||||
|
||||
use app\massage\model\Config;
|
||||
use app\massage\model\Goods;
|
||||
|
||||
use app\massage\model\Order;
|
||||
use app\massage\model\Police;
|
||||
use app\massage\model\RefundOrder;
|
||||
use app\massage\model\RefundOrderGoods;
|
||||
use app\massage\model\User;
|
||||
use app\massage\model\Wallet;
|
||||
use longbingcore\wxcore\WxSetting;
|
||||
use think\App;
|
||||
use think\facade\Db;
|
||||
use think\Request;
|
||||
|
||||
|
||||
class IndexCoach extends ApiRest
|
||||
{
|
||||
|
||||
protected $model;
|
||||
|
||||
protected $cap_info;
|
||||
|
||||
public function __construct(App $app) {
|
||||
|
||||
parent::__construct($app);
|
||||
|
||||
$this->model = new Coach();
|
||||
|
||||
$this->order_model = new Order();
|
||||
|
||||
$cap_dis[] = ['user_id','=',$this->getUserId()];
|
||||
|
||||
$cap_dis[] = ['status','in',[2,3]];
|
||||
|
||||
$this->cap_info = $this->model->dataInfo($cap_dis);
|
||||
|
||||
if(empty($this->cap_info)){
|
||||
|
||||
$this->errorMsg('你还不是技师');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-08 11:39
|
||||
* @功能说明:技师首页
|
||||
*/
|
||||
public function coachIndex(){
|
||||
|
||||
$data = $this->cap_info;
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-23 09:59
|
||||
* @功能说明:修改技师信息
|
||||
*/
|
||||
public function coachUpdate(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $this->cap_info['id']
|
||||
];
|
||||
|
||||
if(!empty($input['id_card'])){
|
||||
|
||||
$input['id_card'] = implode(',',$input['id_card']);
|
||||
}
|
||||
|
||||
if(!empty($input['license'])){
|
||||
|
||||
$input['license'] = implode(',',$input['license']);
|
||||
}
|
||||
|
||||
if(!empty($input['self_img'])){
|
||||
|
||||
$input['self_img'] = implode(',',$input['self_img']);
|
||||
}
|
||||
|
||||
$res = $this->model->dataUpdate($dis,$input);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-19 15:48
|
||||
* @功能说明:个人中心
|
||||
*/
|
||||
public function index(){
|
||||
|
||||
$data = $this->getUserInfo();
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-19 15:48
|
||||
* @功能说明:个人中心
|
||||
*/
|
||||
public function orderList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis[] = ['a.uniacid','=',$this->_uniacid];
|
||||
|
||||
$dis[] = ['a.coach_id','=',$this->cap_info['id']];
|
||||
|
||||
$where = [];
|
||||
|
||||
if(!empty($input['name'])){
|
||||
|
||||
$where[] = ['b.goods_name','like','%'.$input['name'].'%'];
|
||||
|
||||
$where[] = ['a.order_code','like','%'.$input['name'].'%'];
|
||||
|
||||
}
|
||||
|
||||
if($input['pay_type']==5){
|
||||
|
||||
$dis[] = ['a.pay_type','in',[3,4,5]];
|
||||
|
||||
}else{
|
||||
|
||||
$dis[] = ['a.pay_type','=',$input['pay_type']];
|
||||
|
||||
}
|
||||
|
||||
$order_model = new Order();
|
||||
|
||||
$data = $order_model->indexDataList($dis,$where);
|
||||
//待接单数量
|
||||
$data['agent_order_count'] = $order_model->where(['coach_id'=>$this->cap_info['id'],'pay_type'=>2])->count();
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-07 23:11
|
||||
* @功能说明:订单详情
|
||||
*/
|
||||
public function orderInfo(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['order_id']
|
||||
];
|
||||
|
||||
$data = $this->order_model->dataInfo($dis);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-24 13:33
|
||||
* @功能说明:团长审核提现
|
||||
*/
|
||||
public function applyWallet(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
if(empty($input['apply_price'])||$input['apply_price']<0.01){
|
||||
|
||||
$this->errorMsg('提现费最低一分');
|
||||
}
|
||||
//服务费
|
||||
if($input['apply_price']>$this->cap_info['service_price']&&$input['type']==1){
|
||||
|
||||
$this->errorMsg('余额不足');
|
||||
}
|
||||
//车费
|
||||
if($input['apply_price']>$this->cap_info['car_price']&&$input['type']==2){
|
||||
|
||||
$this->errorMsg('余额不足');
|
||||
}
|
||||
|
||||
$coach_level = $this->model->getCoachLevel($this->cap_info['id'],$this->_uniacid);
|
||||
|
||||
// dump($coach_level);exit;
|
||||
//车费没有服务费
|
||||
$balance = !empty($coach_level)&&$input['type']==1?$coach_level['balance']:100;
|
||||
|
||||
$key = 'cap_wallet'.$this->getUserId();
|
||||
|
||||
$value = getCache($key);
|
||||
|
||||
if(!empty($value)){
|
||||
|
||||
$this->errorMsg('网络错误,请刷新重试');
|
||||
|
||||
}
|
||||
//加一个锁防止重复提交
|
||||
incCache($key,1,$this->_uniacid);
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
if($input['type']==1){
|
||||
//减佣金
|
||||
$res = $this->model->dataUpdate(['id'=>$this->cap_info['id']],['service_price'=>$this->cap_info['service_price']-$input['apply_price']]);
|
||||
|
||||
}else{
|
||||
|
||||
$res = $this->model->dataUpdate(['id'=>$this->cap_info['id']],['car_price'=>$this->cap_info['car_price']-$input['apply_price']]);
|
||||
|
||||
}
|
||||
|
||||
if($res!=1){
|
||||
|
||||
Db::rollback();
|
||||
//减掉
|
||||
delCache($key,$this->_uniacid);
|
||||
|
||||
$this->errorMsg('申请失败');
|
||||
}
|
||||
|
||||
$insert = [
|
||||
|
||||
'uniacid' => $this->_uniacid,
|
||||
|
||||
'user_id' => $this->getUserId(),
|
||||
|
||||
'coach_id' => $this->cap_info['id'],
|
||||
|
||||
'total_price' => $input['apply_price'],
|
||||
|
||||
'balance' => $balance,
|
||||
|
||||
'apply_price' => round($input['apply_price']*$balance/100,2),
|
||||
|
||||
'service_price' => round($input['apply_price']-$input['apply_price']*$balance/100,2),
|
||||
|
||||
'code' => orderCode(),
|
||||
|
||||
'text' => $input['text'],
|
||||
|
||||
'type' => $input['type'],
|
||||
|
||||
];
|
||||
|
||||
$wallet_model = new Wallet();
|
||||
//提交审核
|
||||
$res = $wallet_model->dataAdd($insert);
|
||||
|
||||
if($res!=1){
|
||||
|
||||
Db::rollback();
|
||||
//减掉
|
||||
delCache($key,$this->_uniacid);
|
||||
|
||||
$this->errorMsg('申请失败');
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
//减掉
|
||||
delCache($key,$this->_uniacid);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-25 17:14
|
||||
* @功能说明:楼长核销订单
|
||||
*/
|
||||
public function hxOrder(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$order_model= new Order();
|
||||
|
||||
$order = $order_model->dataInfo(['id'=>$input['id']]);
|
||||
|
||||
if(empty($order)){
|
||||
|
||||
$this->errorMsg('订单未找到');
|
||||
}
|
||||
|
||||
if($order['pay_type']!=5){
|
||||
|
||||
$this->errorMsg('订单状态错误');
|
||||
}
|
||||
|
||||
if($order['coach_id']!=$this->cap_info['id']){
|
||||
|
||||
$this->errorMsg('你不是该订单的楼长');
|
||||
|
||||
}
|
||||
|
||||
$refund_model = new RefundOrder();
|
||||
//判断有无申请中的退款订单
|
||||
$refund_order = $refund_model->dataInfo(['order_id'=>$order['id'],'status'=>1]);
|
||||
|
||||
if(!empty($refund_order)){
|
||||
|
||||
$this->errorMsg('该订单正在申请退款,请先处理再核销');
|
||||
|
||||
}
|
||||
|
||||
$res = $order_model->hxOrder($order,$this->cap_info['id']);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-30 13:38
|
||||
* @功能说明:团长端佣金信息
|
||||
*/
|
||||
public function capCashInfo(){
|
||||
|
||||
$this->order_model->coachBalanceArr($this->_uniacid);
|
||||
|
||||
$key = 'cap_wallet'.$this->getUserId();
|
||||
//减掉
|
||||
delCache($key,$this->_uniacid);
|
||||
|
||||
$wallet_model = new Wallet();
|
||||
//可提现佣金
|
||||
$data['cap_cash'] = $this->cap_info['service_price'];
|
||||
//累计提现
|
||||
$data['extract_total_price'] = $wallet_model->capCash($this->cap_info['id'],2,1);
|
||||
//提现中
|
||||
$data['extract_ing_price'] = $wallet_model->capCash($this->cap_info['id'],1,1);
|
||||
|
||||
$dis = [
|
||||
|
||||
'pay_type' => 7,
|
||||
|
||||
'coach_id' => $this->cap_info['id'],
|
||||
|
||||
'have_tx' => 0
|
||||
];
|
||||
//未到账
|
||||
$data['no_received'] = $this->order_model->where($dis)->sum('service_price');
|
||||
|
||||
$data['coach_level'] = $this->model->getCoachLevel($this->cap_info['id'],$this->_uniacid);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-30 13:38
|
||||
* @功能说明:团长端佣金信息
|
||||
*/
|
||||
public function capCashInfoCar(){
|
||||
|
||||
$key = 'cap_wallet'.$this->getUserId();
|
||||
//减掉
|
||||
delCache($key,$this->_uniacid);
|
||||
|
||||
$wallet_model = new Wallet();
|
||||
//可提现佣金
|
||||
$data['cap_cash'] = $this->cap_info['car_price'];
|
||||
//累计提现
|
||||
$data['extract_total_price'] = $wallet_model->capCash($this->cap_info['id'],2,2);
|
||||
//提现中
|
||||
$data['extract_ing_price'] = $wallet_model->capCash($this->cap_info['id'],1,2);
|
||||
|
||||
$dis = [
|
||||
|
||||
'pay_type' => 7,
|
||||
|
||||
'coach_id' => $this->cap_info['id'],
|
||||
|
||||
'have_tx' => 0
|
||||
];
|
||||
//未到账
|
||||
$data['no_received'] = $this->order_model->where($dis)->sum('car_price');
|
||||
|
||||
$data['coach_level'] = $this->model->getCoachLevel($this->cap_info['id'],$this->_uniacid);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-30 14:39
|
||||
* @功能说明:团长提现记录
|
||||
*/
|
||||
public function capCashList(){
|
||||
|
||||
$wallet_model = new Wallet();
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis = [
|
||||
|
||||
'coach_id' => $this->cap_info['id']
|
||||
];
|
||||
|
||||
if(!empty($input['status'])){
|
||||
|
||||
$dis['status'] = $input['status'];
|
||||
}
|
||||
|
||||
$dis['type'] = $input['type'];
|
||||
//提现记录
|
||||
$data = $wallet_model->dataList($dis,10);
|
||||
|
||||
if(!empty($data['data'])){
|
||||
|
||||
foreach ($data['data'] as &$v){
|
||||
|
||||
$v['create_time'] = date('Y-m-d H:i:s',$v['create_time']);
|
||||
}
|
||||
}
|
||||
//累计提现
|
||||
$data['extract_total_price'] = $wallet_model->capCash($this->cap_info['id'],2,$input['type']);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-08 17:09
|
||||
* @功能说明:报警
|
||||
*/
|
||||
public function police(){
|
||||
|
||||
$insert = [
|
||||
|
||||
'uniacid' => $this->_uniacid,
|
||||
|
||||
'coach_id'=> $this->cap_info['id'],
|
||||
|
||||
'user_id' => $this->cap_info['user_id'],
|
||||
|
||||
'text' => '正在发出求救信号,请及时查看技师正在服务的订单地址和电话,确认报警信息'
|
||||
];
|
||||
|
||||
|
||||
$police_model = new Police();
|
||||
|
||||
$res = $police_model->dataAdd($insert);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-11 22:34
|
||||
* @功能说明:技师修改订单信息)
|
||||
*/
|
||||
public function updateOrder(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$order = $this->order_model->dataInfo(['id'=>$input['order_id']]);
|
||||
|
||||
$update = $this->order_model->coachOrdertext($input);
|
||||
|
||||
Db::startTrans();
|
||||
//核销订单
|
||||
if($input['type']==7){
|
||||
|
||||
if($order['pay_type']!=6){
|
||||
|
||||
$this->errorMsg('订单状态错误');
|
||||
}
|
||||
|
||||
$refund_model = new RefundOrder();
|
||||
//判断有无申请中的退款订单
|
||||
$refund_order = $refund_model->dataInfo(['order_id'=>$order['id'],'status'=>1]);
|
||||
|
||||
if(!empty($refund_order)){
|
||||
|
||||
$this->errorMsg('该订单正在申请退款,请先处理再核销');
|
||||
|
||||
}
|
||||
|
||||
$res = $this->order_model->hxOrder($order,$this->cap_info['id']);
|
||||
|
||||
$res = $this->order_model->dataUpdate(['id'=>$input['order_id']],$update);
|
||||
|
||||
}else{
|
||||
|
||||
// dump($update);exit;
|
||||
|
||||
$res = $this->order_model->dataUpdate(['id'=>$input['order_id']],$update);
|
||||
//拒绝接单
|
||||
if($input['type']==-1){
|
||||
|
||||
if($order['pay_type']!=2){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
$this->errorMsg('已接单');
|
||||
|
||||
}
|
||||
|
||||
if($order['pay_price']>0){
|
||||
|
||||
$refund_model = new RefundOrder();
|
||||
|
||||
$res = $refund_model->refundCash($this->payConfig(),$order,$order['pay_price']);
|
||||
|
||||
if(!empty($res['code'])){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
$this->errorMsg($res['msg']);
|
||||
|
||||
}
|
||||
|
||||
if($res!=true){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
$this->errorMsg('退款失败,请重试2');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
308
app/massage/controller/IndexGoods.php
Normal file
308
app/massage/controller/IndexGoods.php
Normal file
@@ -0,0 +1,308 @@
|
||||
<?php
|
||||
namespace app\massage\controller;
|
||||
use app\ApiRest;
|
||||
|
||||
use app\Rest;
|
||||
|
||||
use app\massage\model\Cap;
|
||||
use app\massage\model\Car;
|
||||
use app\massage\model\Goods;
|
||||
use app\massage\model\GoodsCate;
|
||||
use app\massage\model\User;
|
||||
use think\App;
|
||||
|
||||
use think\Request;
|
||||
|
||||
|
||||
|
||||
class IndexGoods extends ApiRest
|
||||
{
|
||||
|
||||
protected $model;
|
||||
|
||||
protected $cate_model;
|
||||
|
||||
protected $car_model;
|
||||
|
||||
public function __construct(App $app) {
|
||||
|
||||
parent::__construct($app);
|
||||
|
||||
$this->model = new Goods();
|
||||
|
||||
// $this->cate_model = new GoodsCate();
|
||||
|
||||
$this->car_model = new Car();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-18 16:46
|
||||
* @功能说明:分类列表
|
||||
*/
|
||||
public function cateList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis = [
|
||||
|
||||
'uniacid' => $this->_uniacid,
|
||||
|
||||
'status' => 1,
|
||||
|
||||
'cap_id' => $this->getCapInfo()['id']
|
||||
];
|
||||
|
||||
$data = $this->cate_model->where($dis)->order('id desc')->select()->toArray();
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-24 14:19
|
||||
* @功能说明:商品列表
|
||||
*/
|
||||
public function goodsList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis = [
|
||||
|
||||
'uniacid' => $this->_uniacid,
|
||||
|
||||
'status' => 1,
|
||||
|
||||
];
|
||||
|
||||
//商品信息
|
||||
$data = $this->model->dataList($dis,10);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-24 14:07
|
||||
* @功能说明:购物车信息
|
||||
*/
|
||||
public function carInfo(){
|
||||
//购物车信息
|
||||
$car_info = $this->car_model->carPriceAndCount($this->getUserId(),$this->getCapInfo()['id'],1);
|
||||
|
||||
return $this->success($car_info);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-19 15:46
|
||||
* @功能说明:商品详情
|
||||
*/
|
||||
public function goodsInfo(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $input['id']
|
||||
];
|
||||
|
||||
$data = $this->model->dataInfo($dis);
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-19 11:57
|
||||
* @功能说明:首页选择楼长列表
|
||||
*/
|
||||
public function indexCapList(){
|
||||
|
||||
$input = $this->_param;
|
||||
|
||||
$dis[] = ['uniacid','=',$this->_uniacid];
|
||||
|
||||
$dis[] = ['status','=',2];
|
||||
|
||||
$dis[] = ['business_status','=',1];
|
||||
|
||||
if(!empty($input['store_name'])){
|
||||
|
||||
$dis[] = ['store_name','like','%'.$input['store_name'].'%'];
|
||||
}
|
||||
|
||||
$lat = !empty($input['lat'])?$input['lat']:0;
|
||||
|
||||
$lng = !empty($input['lng'])?$input['lng']:0;
|
||||
|
||||
$alh = '(2 * 6378.137* ASIN(SQRT(POW(SIN(3.1415926535898*('.$lat.'-lat)/360),2)+COS(3.1415926535898*'.$lat.'/180)* COS('.$lat.' * 3.1415926535898/180)*POW(SIN(3.1415926535898*('.$lng.'-lng)/360),2))))*1000 as distance';
|
||||
|
||||
$alhs = '(2 * 6378.137* ASIN(SQRT(POW(SIN(3.1415926535898*('.$lat.'-lat)/360),2)+COS(3.1415926535898*'.$lat.'/180)* COS('.$lat.' * 3.1415926535898/180)*POW(SIN(3.1415926535898*('.$lng.'-lng)/360),2))))*1000<20000';
|
||||
|
||||
$cap_model = new Cap();
|
||||
|
||||
$data = $cap_model->dataList($dis,$alh,$alhs,10);
|
||||
|
||||
if(!empty($data['data'])){
|
||||
|
||||
foreach ($data['data'] as &$v){
|
||||
|
||||
$v['distance'] = getDistances($v['lng'],$v['lat'],$lng,$lat);
|
||||
|
||||
$v['distance'] = $cap_model->getDistanceAttr($v['distance']);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $this->success($data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-19 13:24
|
||||
* @功能说明:选择楼长
|
||||
*/
|
||||
public function selectCap(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$user_model = new User();
|
||||
|
||||
$res = $user_model->dataUpdate(['id'=>$this->getUserId()],['cap_id'=>$input['cap_id']]);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-24 14:46
|
||||
* @功能说明:添加到购物车
|
||||
*/
|
||||
public function addCar(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$insert = [
|
||||
|
||||
'uniacid' => $this->_uniacid,
|
||||
|
||||
'user_id' => $this->getUserId(),
|
||||
|
||||
'cap_id' => $this->getCapInfo()['id'],
|
||||
|
||||
'goods_id'=> $input['goods_id'],
|
||||
|
||||
'spe_id' => $input['spe_id']
|
||||
|
||||
];
|
||||
|
||||
$info = $this->car_model->dataInfo($insert);
|
||||
//增加数量
|
||||
if(!empty($info)){
|
||||
|
||||
$res = $this->car_model->dataUpdate(['id'=>$info['id']],['goods_num'=>$info['goods_num']+$input['goods_num']]);
|
||||
|
||||
}else{
|
||||
//添加到购物车
|
||||
$insert['goods_num'] = $input['goods_num'];
|
||||
|
||||
$insert['status'] = 1;
|
||||
|
||||
$res = $this->car_model->dataAdd($insert);
|
||||
|
||||
}
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-24 14:54
|
||||
* @功能说明:删除购物车
|
||||
*/
|
||||
public function delCar(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$info = $this->car_model->dataInfo(['id'=>$input['id']]);
|
||||
//加少数量
|
||||
if($info['goods_num']>$input['goods_num']){
|
||||
|
||||
$res = $this->car_model->dataUpdate(['id'=>$info['id']],['goods_num'=>$info['goods_num']-$input['goods_num']]);
|
||||
|
||||
}else{
|
||||
|
||||
$res = $this->car_model->where(['id'=>$info['id']])->delete();
|
||||
}
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-25 10:39
|
||||
* @功能说明:
|
||||
*/
|
||||
public function carUpdate(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$res = $this->car_model->where('id','in',$input['id'])->update(['status'=>$input['status']]);
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-24 14:59
|
||||
* @功能说明:批量删除购物车
|
||||
*/
|
||||
public function delSomeCar(){
|
||||
|
||||
$input = $this->_input;
|
||||
|
||||
$dis = [
|
||||
|
||||
'uniacid' => $this->_uniacid,
|
||||
|
||||
'user_id' => $this->getUserId(),
|
||||
|
||||
'cap_id' => $this->getCapInfo()['id'],
|
||||
|
||||
];
|
||||
|
||||
$res = $this->car_model->where($dis)->delete();
|
||||
|
||||
return $this->success($res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
1010
app/massage/controller/IndexOrder.php
Normal file
1010
app/massage/controller/IndexOrder.php
Normal file
File diff suppressed because it is too large
Load Diff
1465
app/massage/controller/IndexUser.php
Normal file
1465
app/massage/controller/IndexUser.php
Normal file
File diff suppressed because it is too large
Load Diff
181
app/massage/controller/IndexWxPay.php
Normal file
181
app/massage/controller/IndexWxPay.php
Normal file
@@ -0,0 +1,181 @@
|
||||
<?php
|
||||
namespace app\massage\controller;
|
||||
use app\AdminRest;
|
||||
use app\ApiRest;
|
||||
use think\App;
|
||||
use app\shop\controller\IndexPayResunt;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
class IndexWxPay extends ApiRest
|
||||
{
|
||||
|
||||
protected $app;
|
||||
public function __construct ( App $app )
|
||||
{
|
||||
$this->app = $app;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $paymentApp
|
||||
* @param $openid
|
||||
* @param $uniacid
|
||||
* @param $body
|
||||
* @param $attach
|
||||
* @param $totalprice
|
||||
* @throws \WxPayException
|
||||
* 支付
|
||||
*/
|
||||
public function createWeixinPay($paymentApp , $openid , $uniacid , $body , $attach,$totalprice){
|
||||
global $_GPC, $_W;
|
||||
$setting['mini_appid'] = $paymentApp['app_id'];
|
||||
$setting['mini_appsecrept'] = $paymentApp['secret'];
|
||||
$setting['mini_mid'] = $paymentApp['payment']['merchant_id'];
|
||||
$setting['mini_apicode'] = $paymentApp['payment']['key'];
|
||||
$setting['apiclient_cert'] = $paymentApp['payment']['cert_path'];
|
||||
$setting['apiclient_cert_key'] = $paymentApp['payment']['key_path'];
|
||||
define('WX_APPID', $setting['mini_appid']);
|
||||
define('WX_MCHID', $setting['mini_mid']);
|
||||
define('WX_KEY', $setting['mini_apicode']);
|
||||
define('WX_APPSECRET', $setting['mini_appsecrept']);
|
||||
define('WX_SSLCERT_PATH', $setting['apiclient_cert']);
|
||||
define('WX_SSLKEY_PATH', $setting['apiclient_cert_key']);
|
||||
define('WX_CURL_PROXY_HOST', '0.0.0.0');
|
||||
define('WX_CURL_PROXY_PORT', 0);
|
||||
define('WX_REPORT_LEVENL', 0);
|
||||
|
||||
|
||||
require_once PAY_PATH . "/weixinpay/lib/WxPay.Api.php";
|
||||
require_once PAY_PATH . "/weixinpay/example/WxPay.JsApiPay.php";
|
||||
|
||||
$tools = new \JsApiPay();
|
||||
$input = new \WxPayUnifiedOrder();
|
||||
|
||||
$input->SetBody($body);
|
||||
$input->SetAttach(json_encode($attach));
|
||||
$input->SetOut_trade_no($attach['out_trade_no']);
|
||||
$input->SetTotal_fee($totalprice *100);
|
||||
$input->SetTime_start(date("YmdHis"));
|
||||
|
||||
$param_arr=[
|
||||
'i' => $uniacid,
|
||||
't' => $_GPC['t'],
|
||||
'v' => $_GPC['v'],
|
||||
'n' => APP_MODEL_NAME
|
||||
];
|
||||
$reply_path=json_encode($param_arr);
|
||||
//需要判断 是否是微擎的版本
|
||||
if(defined('IS_WEIQIN')){
|
||||
$path = "https://" . $_SERVER['HTTP_HOST'] ."/addons/".APP_MODEL_NAME."/core2/app/Common/wexinPay.php?params=".$reply_path;
|
||||
$paths = "https://" . $_SERVER['HTTP_HOST'] ."/addons/".APP_MODEL_NAME."/core2/app/Common/wexinPay.php?ck=789";
|
||||
$a = file_get_contents($paths);
|
||||
if($a != 1){
|
||||
$this->errorMsg('发起支付失败');
|
||||
}
|
||||
}else{
|
||||
$path = "https://" . $_SERVER['HTTP_HOST'] ."/wexinPay.php?params=".$reply_path;
|
||||
$paths = "https://" . $_SERVER['HTTP_HOST'] ."/wexinPay.php?ck=789";
|
||||
$a = file_get_contents($paths);
|
||||
if($a != 1){
|
||||
$this->errorMsg('发起支付失败');
|
||||
}
|
||||
|
||||
}
|
||||
$this ->lb_logOutput('BaseApiPath:-----'.$path);
|
||||
$input->SetNotify_url($path);
|
||||
$input->SetTrade_type("JSAPI");
|
||||
$input->SetOpenid($openid);
|
||||
$order = \WxPayApi::unifiedOrder($input);
|
||||
if(!empty($order['return_code'])&&$order['return_code'] == 'FAIL'){
|
||||
$this->errorMsg($order['return_msg']);
|
||||
}
|
||||
$jsApiParameters = $tools->GetJsApiParameters($order);
|
||||
|
||||
$jsApiParameters = json_decode($jsApiParameters, true) ;
|
||||
if (!empty($jsApiParameters['return_code']))
|
||||
$this->errorMsg( '发起支付失败');
|
||||
|
||||
return $jsApiParameters;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @param int $flag
|
||||
* @return void|null
|
||||
* 打印数据
|
||||
*/
|
||||
|
||||
public function lb_logOutput($data,$flag=0) {
|
||||
if($flag==0){
|
||||
return ;
|
||||
}
|
||||
//数据类型检测
|
||||
if (is_array($data)) {
|
||||
$data = json_encode($data);
|
||||
}
|
||||
$filename = "./".date("Y-m-d").".log";
|
||||
$str = date("Y-m-d H:i:s")." $data"."\r\n";
|
||||
file_put_contents($filename, $str, FILE_APPEND|LOCK_EX);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付回调
|
||||
*/
|
||||
|
||||
public function returnPay(){
|
||||
|
||||
|
||||
$this->lb_logOutput("in--mingpianNotify");
|
||||
$xmlData = file_get_contents('php://input');
|
||||
if(empty($xmlData)){
|
||||
$xmlData = 'empty xmlData';
|
||||
}
|
||||
$this->lb_logOutput('xmlData in mingpian:-----'.$xmlData);
|
||||
|
||||
$this->lb_logOutput("in-mingpian2");
|
||||
global $_GPC;
|
||||
$xmlData = file_get_contents('php://input');
|
||||
$this->lb_logOutput('in-mingpian-$xmlData:-----'.$xmlData);
|
||||
//获取配置
|
||||
|
||||
if(defined( 'IS_WEIQIN' )){
|
||||
$uniacid=$_GPC['i'];
|
||||
}else{
|
||||
$uniacid = $_GET['i'];
|
||||
}
|
||||
|
||||
$paymentApp = $this->payConfig($uniacid);
|
||||
// dump($paymentApp);exit;
|
||||
$this->lb_logOutput('in-mingpian-uniacid:-----'.$uniacid);
|
||||
|
||||
$setting['mini_appid'] = $paymentApp['app_id'];
|
||||
$setting['mini_appsecrept'] = $paymentApp['secret'];
|
||||
$setting['mini_mid'] = $paymentApp['payment']['merchant_id'];
|
||||
$setting['mini_apicode'] = $paymentApp['payment']['key'];
|
||||
$setting['apiclient_cert'] = $paymentApp['payment']['cert_path'];
|
||||
$setting['apiclient_cert_key'] = $paymentApp['payment']['key_path'];
|
||||
|
||||
define('WX_APPID', $setting['mini_appid']);
|
||||
define('WX_MCHID', $setting['mini_mid']);
|
||||
define('WX_KEY', $setting['mini_apicode']);
|
||||
define('WX_APPSECRET', $setting['mini_appsecrept']);
|
||||
define('WX_SSLCERT_PATH', $setting['apiclient_cert']);
|
||||
define('WX_SSLKEY_PATH', $setting['apiclient_cert_key']);
|
||||
define('WX_CURL_PROXY_HOST', '0.0.0.0');
|
||||
define('WX_CURL_PROXY_PORT', 0);
|
||||
define('WX_REPORT_LEVENL', 0);
|
||||
require_once PAY_PATH.'/weixinpay/lib/WxOrderNotify.php';
|
||||
$WxPay = new \WxOrderNotify($this->app);
|
||||
$WxPay->Handle(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
275
app/massage/controller/Tcp.php
Normal file
275
app/massage/controller/Tcp.php
Normal file
@@ -0,0 +1,275 @@
|
||||
<?php
|
||||
namespace app\massage\controller;
|
||||
use app\AdminRest;
|
||||
use app\BaseController;
|
||||
use app\massage\model\Service;
|
||||
use app\shop\model\Article;
|
||||
use app\shop\model\Banner;
|
||||
use app\shop\model\Cap;
|
||||
use app\shop\model\GoodsCate;
|
||||
use app\shop\model\GoodsSh;
|
||||
use app\shop\model\GoodsShList;
|
||||
use think\App;
|
||||
use app\shop\model\Goods as Model;
|
||||
use think\Db;
|
||||
use think\facade\View;
|
||||
|
||||
|
||||
class Tcp extends BaseController
|
||||
{
|
||||
|
||||
|
||||
protected $model;
|
||||
|
||||
protected $goods_sh;
|
||||
|
||||
protected $goods_sh_list;
|
||||
|
||||
public function __construct(App $app) {
|
||||
|
||||
parent::__construct($app);
|
||||
|
||||
// $this->model = new Service();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-29 16:25
|
||||
* @功能说明:远程获取信息
|
||||
*/
|
||||
public function getInfo(){
|
||||
|
||||
//获取param
|
||||
$input= $this->request->param();
|
||||
|
||||
if(!empty($input['card_id'])&&!empty($input['time'])){
|
||||
|
||||
$info = \think\facade\Db::name('shequshop_car_atv_speed_test')->where(['card_id'=>$input['card_id']])->find();
|
||||
|
||||
$insert = [
|
||||
|
||||
'card_id' => $input['card_id'],
|
||||
|
||||
'time' => date('Y-m-d H:i:s',time()),
|
||||
|
||||
'uniacid' => 1,
|
||||
|
||||
'time_str'=> time()
|
||||
];
|
||||
|
||||
if(empty($info)){
|
||||
|
||||
\think\facade\Db::name('shequshop_car_atv_speed_test')->insert($insert);
|
||||
|
||||
}else{
|
||||
|
||||
\think\facade\Db::name('shequshop_car_atv_speed_test')->where(['id'=>$info['id']])->update($insert);
|
||||
//如果两次信号间隔时间小于30秒 不记录
|
||||
if(time()-$info['time_str']<30){
|
||||
|
||||
echo 2;exit;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
echo true;exit;
|
||||
|
||||
}
|
||||
|
||||
$card_id = $input['card_id'];
|
||||
|
||||
$dis = [
|
||||
|
||||
'now_card_id' => $card_id
|
||||
];
|
||||
|
||||
$game = \think\facade\Db::name('shequshop_car_game')->where($dis)->find();
|
||||
|
||||
//当前绑卡的比赛
|
||||
if(!empty($game)){
|
||||
|
||||
$dis = [
|
||||
|
||||
'record_id' => $game['id'],
|
||||
|
||||
'end_time' => 0
|
||||
];
|
||||
//查看是开始还是结束
|
||||
$is_start = \think\facade\Db::name('shequshop_car_atv_speed')->where($dis)->find();
|
||||
|
||||
$c_time = time()-$game['last_time'];
|
||||
//如果两个信号接受时间未超过40秒 不记录信息
|
||||
if($c_time<30){
|
||||
|
||||
echo false;exit;
|
||||
}
|
||||
//开始
|
||||
if(empty($is_start)){
|
||||
|
||||
$insert = [
|
||||
|
||||
'uniacid' => $game['uniacid'],
|
||||
|
||||
'record_id' => $game['id'],
|
||||
|
||||
'user_id' => $game['user_id'],
|
||||
|
||||
'start_time' => $input['time'],
|
||||
|
||||
];
|
||||
|
||||
\think\facade\Db::name('shequshop_car_atv_speed')->insert($insert);
|
||||
|
||||
}else{
|
||||
|
||||
// //如果两个信号接受时间未超过40秒 不记录信息
|
||||
// if($c_time<40){
|
||||
//
|
||||
// echo false;exit;
|
||||
// }
|
||||
|
||||
$time = $input['time'] - $is_start['start_time'];
|
||||
//结束
|
||||
$update = [
|
||||
|
||||
'end_time' => $input['time'],
|
||||
|
||||
'time' => $time,
|
||||
|
||||
];
|
||||
|
||||
\think\facade\Db::name('shequshop_car_atv_speed')->where(['id'=>$is_start['id']])->update($update);
|
||||
|
||||
if($time<$game['best_time']||$game['best_time']==0){
|
||||
|
||||
$update_game = [
|
||||
|
||||
'best_time' => $time
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
$total_time = $game['total_time']+$time;
|
||||
|
||||
$game['have_num']++;
|
||||
|
||||
$update_game['total_time'] = $total_time;
|
||||
|
||||
$update_game['have_game'] = 1;
|
||||
|
||||
$update_game['status'] = 2;
|
||||
|
||||
$update_game['have_num'] = $game['have_num'];
|
||||
//修改最好成绩
|
||||
\think\facade\Db::name('shequshop_car_game')->where(['id'=>$game['id']])->update($update_game);
|
||||
//第二圈开始
|
||||
$insert = [
|
||||
|
||||
'uniacid' => $game['uniacid'],
|
||||
|
||||
'record_id' => $game['id'],
|
||||
|
||||
'user_id' => $game['user_id'],
|
||||
|
||||
'start_time' => $input['time'],
|
||||
|
||||
];
|
||||
|
||||
\think\facade\Db::name('shequshop_car_atv_speed')->insert($insert);
|
||||
|
||||
}
|
||||
|
||||
$update = [
|
||||
|
||||
'last_time' => intval($input['time']/1000),
|
||||
|
||||
];
|
||||
|
||||
if(empty($game['start_time'])){
|
||||
|
||||
$update['start_time'] = intval($input['time']/1000);
|
||||
|
||||
$update['day'] = date('Y-m-d',time());
|
||||
}
|
||||
//修改最后接受信息时间
|
||||
\think\facade\Db::name('shequshop_car_game')->where(['id'=>$game['id']])->update($update);
|
||||
|
||||
}
|
||||
|
||||
|
||||
echo true;exit;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-10-28 14:53
|
||||
* @功能说明:
|
||||
*/
|
||||
public function gameList(){
|
||||
|
||||
$dis = [
|
||||
|
||||
'uniacid' => 1,
|
||||
|
||||
'have_game' => 1
|
||||
|
||||
];
|
||||
|
||||
$data = \think\facade\Db::name('shequshop_car_game')->where($dis)->field('best_time,start_time,user_id')->order('start_time desc,best_time')->limit(50)->select()->toArray();
|
||||
|
||||
|
||||
if(!empty($data)){
|
||||
|
||||
foreach ($data as &$v){
|
||||
|
||||
$v['user_name'] = \think\facade\Db::name('massage_service_user_list')->where(['id'=>$v['user_id']])->value('nickName');
|
||||
|
||||
$v['start_time'] = date('m-d H:i:s',$v['start_time']);
|
||||
|
||||
$v['best_time'] = game_time($v['best_time']);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$count = count($data);
|
||||
|
||||
View::assign('data', $data);
|
||||
|
||||
View::assign('count', $count);
|
||||
|
||||
return View::fetch();
|
||||
|
||||
echo json_encode($datas);exit;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
596
app/massage/info/AdminMenu.php
Normal file
596
app/massage/info/AdminMenu.php
Normal file
@@ -0,0 +1,596 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: shuixian
|
||||
* Date: 2019/11/20
|
||||
* Time: 18:29
|
||||
*/
|
||||
|
||||
|
||||
$tmp = sassAuth()==1?',{
|
||||
"name": "PurchaseList",
|
||||
"url": "/malls/purchase"
|
||||
}':'';
|
||||
|
||||
$malls = <<<MALLS
|
||||
|
||||
|
||||
{
|
||||
"path": "/malls",
|
||||
"component": "Layout",
|
||||
"redirect": "/malls/list",
|
||||
"meta": {
|
||||
"menuName": "Malls",
|
||||
"icon": "icon-gouwudai",
|
||||
"subNavName": [{
|
||||
"name": "MallsManage",
|
||||
"url": [{
|
||||
"name": "GoodsList",
|
||||
"url": "/malls/list"
|
||||
}, {
|
||||
"name": "GoodsClassify",
|
||||
"url": "/malls/classify"
|
||||
}, {
|
||||
"name": "ParameterManagement",
|
||||
"url": "/malls/parameter"
|
||||
} $tmp
|
||||
]
|
||||
}, {
|
||||
"name": "StoreManage",
|
||||
"url": [{
|
||||
"name": "StoreList",
|
||||
"url": "/malls/storeManage"
|
||||
}]
|
||||
}, {
|
||||
"name": "OrderManage",
|
||||
"url": [{
|
||||
"name": "OrderManage",
|
||||
"url": "/malls/orderManage"
|
||||
}, {
|
||||
"name": "RefundManage",
|
||||
"url": "/malls/refundManage"
|
||||
}]
|
||||
}, {
|
||||
"name": "MarketingManage",
|
||||
"url": [{
|
||||
"name": "AssembleList",
|
||||
"url": "/malls/assemble"
|
||||
}, {
|
||||
"name": "RedPackit",
|
||||
"url": "/malls/redPackit"
|
||||
}]
|
||||
}, {
|
||||
"name": "MallsSet",
|
||||
"url": [{
|
||||
"name": "DealSet",
|
||||
"url": "/malls/dealSet"
|
||||
}, {
|
||||
"name": "VirtualPaymentSet",
|
||||
"url": "/malls/virtualPayment"
|
||||
}, {
|
||||
"name": "StaffChoiceGoods",
|
||||
"url": "/malls/staffGoods"
|
||||
}, {
|
||||
"name": "MallsBanner",
|
||||
"url": "/malls/banner"
|
||||
}]
|
||||
}, {
|
||||
"name": "Distributioninfo",
|
||||
"url": [{
|
||||
"name": "ProfitInfo",
|
||||
"url": "/malls/profit"
|
||||
}, {
|
||||
"name": "CommissionInfo",
|
||||
"url": "/malls/commission"
|
||||
}, {
|
||||
"name": "TakeCashInfo",
|
||||
"url": "/malls/cash"
|
||||
}, {
|
||||
"name": "DistributionRelation",
|
||||
"url": "/malls/relation"
|
||||
}, {
|
||||
"name": "DistributionSetting",
|
||||
"url": "/malls/disSet"
|
||||
}, {
|
||||
"name": "DistributionCash",
|
||||
"url": "/malls/disCash"
|
||||
}, {
|
||||
"name": "DistributionAudit",
|
||||
"url": "/malls/disaudit"
|
||||
}]
|
||||
}]
|
||||
},
|
||||
"children": [{
|
||||
"path": "list",
|
||||
"name": "GoodsList",
|
||||
"component": "/malls/goods/list",
|
||||
"meta": {
|
||||
"keepAlive": true,
|
||||
"refresh": false,
|
||||
"title": "MallsManage",
|
||||
"isOnly": false,
|
||||
"auth": [],
|
||||
"pagePermission": [{
|
||||
"title": "GoodsList",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"path": "edit",
|
||||
"name": "GoodsEdit",
|
||||
"component": "/malls/goods/edit",
|
||||
"meta": {
|
||||
"title": "MallsManage",
|
||||
"isOnly": false,
|
||||
"auth": [],
|
||||
"pagePermission": [{
|
||||
"title": "GoodsEdit",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"path": "classify",
|
||||
"name": "GoodsClassify",
|
||||
"component": "/malls/goods/classify",
|
||||
"meta": {
|
||||
"keepAlive": true,
|
||||
"refresh": false,
|
||||
"title": "MallsManage",
|
||||
"isOnly": false,
|
||||
"auth": [],
|
||||
"pagePermission": [{
|
||||
"title": "GoodsClassify",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"path": "addClassify",
|
||||
"name": "SpecsClassify",
|
||||
"component": "/malls/goods/addClassify",
|
||||
"meta": {
|
||||
"title": "MallsManage",
|
||||
"isOnly": false,
|
||||
"auth": [],
|
||||
"pagePermission": [{
|
||||
"title": "AddClassify",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"path": "parameter",
|
||||
"name": "ParameterManagement",
|
||||
"component": "/malls/goods/parameter",
|
||||
"meta": {
|
||||
"keepAlive": true,
|
||||
"refresh": false,
|
||||
"title": "MallsManage",
|
||||
"isOnly": false,
|
||||
"auth": [],
|
||||
"pagePermission": [{
|
||||
"title": "ParameterManagement",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"path": "parimary",
|
||||
"name": "parimar",
|
||||
"component": "/malls/goods/parimary",
|
||||
"meta": {
|
||||
"title": "MallsManage",
|
||||
"isOnly": false,
|
||||
"auth": [],
|
||||
"pagePermission": [{
|
||||
"title": "parimar",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"path": "secndparimary",
|
||||
"name": "secndParimar",
|
||||
"component": "/malls/goods/secndparimary",
|
||||
"meta": {
|
||||
"title": "MallsManage",
|
||||
"isOnly": false,
|
||||
"auth": [],
|
||||
"pagePermission": [{
|
||||
"title": "secndParimar",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"path": "purchase",
|
||||
"name": "PurchaseList",
|
||||
"component": "/malls/goods/purchase",
|
||||
"meta": {
|
||||
"keepAlive": true,
|
||||
"refresh": false,
|
||||
"title": "MallsManage",
|
||||
"isOnly": false,
|
||||
"auth": [],
|
||||
"pagePermission": [{
|
||||
"title": "PurchaseList",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"path": "editPurchase",
|
||||
"name": "PurchaseAdd",
|
||||
"component": "/malls/goods/editPurchase",
|
||||
"meta": {
|
||||
"title": "MallsManage",
|
||||
"isOnly": false,
|
||||
"auth": [],
|
||||
"pagePermission": [{
|
||||
"title": "PurchaseAdd",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "wholesale",
|
||||
"name": "WholesaleList",
|
||||
"component": "/malls/goods/wholesale",
|
||||
"meta": {
|
||||
"keepAlive": true,
|
||||
"refresh": false,
|
||||
"title": "MallsManage",
|
||||
"isOnly": false,
|
||||
"auth": [],
|
||||
"pagePermission": [{
|
||||
"title": "WholesaleList",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"path": "editWholesale",
|
||||
"name": "WholesaleAdd",
|
||||
"component": "/malls/goods/editWholesale",
|
||||
"meta": {
|
||||
"title": "MallsManage",
|
||||
"isOnly": false,
|
||||
"auth": [],
|
||||
"pagePermission": [{
|
||||
"title": "WholesaleAdd",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}
|
||||
,{
|
||||
"path": "storeManage",
|
||||
"name": "StoreList",
|
||||
"component": "/malls/store/list",
|
||||
"meta": {
|
||||
"keepAlive": true,
|
||||
"title": "MallsManage",
|
||||
"isOnly": false,
|
||||
"auth": [],
|
||||
"pagePermission": [{
|
||||
"title": "StoreList",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"path": "store",
|
||||
"name": "StoreAdd",
|
||||
"component": "/malls/store/edit",
|
||||
"meta": {
|
||||
"title": "MallsManage",
|
||||
"isOnly": false,
|
||||
"auth": [],
|
||||
"pagePermission": [{
|
||||
"title": "StoreAdd",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"path": "orderManage",
|
||||
"name": "OrderManage",
|
||||
"component": "/malls/order/manage",
|
||||
"meta": {
|
||||
"keepAlive": true,
|
||||
"title": "MallsManage",
|
||||
"isOnly": false,
|
||||
"auth": [],
|
||||
"pagePermission": [{
|
||||
"title": "OrderManage",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"path": "orderDetail",
|
||||
"name": "OrderDetail",
|
||||
"component": "/malls/order/detail",
|
||||
"meta": {
|
||||
"title": "MallsManage",
|
||||
"isOnly": false,
|
||||
"auth": [],
|
||||
"pagePermission": [{
|
||||
"title": "OrderDetail",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"path": "refundManage",
|
||||
"name": "RefundManage",
|
||||
"component": "/malls/order/refund",
|
||||
"meta": {
|
||||
"keepAlive": true,
|
||||
"title": "MallsManage",
|
||||
"isOnly": false,
|
||||
"auth": [],
|
||||
"pagePermission": [{
|
||||
"title": "RefundManage",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"path": "newAssemble",
|
||||
"name": "NewAssemble",
|
||||
"component": "/malls/marketing/newAssemble",
|
||||
"meta": {
|
||||
"keepAlive": true,
|
||||
"title": "MallsManage",
|
||||
"isOnly": false,
|
||||
"auth": [],
|
||||
"pagePermission": [{
|
||||
"title": "NewAssemble",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"path": "assemble",
|
||||
"name": "AssembleList",
|
||||
"component": "/malls/marketing/assemble",
|
||||
"meta": {
|
||||
"title": "MallsManage",
|
||||
"isOnly": false,
|
||||
"auth": [],
|
||||
"pagePermission": [{
|
||||
"title": "AssembleList",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"path": "assembleManage",
|
||||
"name": "AssembleManage",
|
||||
"component": "/malls/marketing/assembleManage",
|
||||
"meta": {
|
||||
"title": "MallsManage",
|
||||
"isOnly": false,
|
||||
"auth": [],
|
||||
"pagePermission": [{
|
||||
"title": "AssembleManage",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"path": "redPackit",
|
||||
"name": "RedPackit",
|
||||
"component": "/malls/marketing/redPackit",
|
||||
"meta": {
|
||||
"keepAlive": true,
|
||||
"title": "MallsManage",
|
||||
"isOnly": false,
|
||||
"auth": [],
|
||||
"pagePermission": [{
|
||||
"title": "RedPackit",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"path": "addRedPackit",
|
||||
"name": "EditRedPackit",
|
||||
"component": "/malls/marketing/addRedPackit",
|
||||
"meta": {
|
||||
"title": "MallsManage",
|
||||
"isOnly": false,
|
||||
"auth": [],
|
||||
"pagePermission": [{
|
||||
"title": "EditRedPackit",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"path": "dealSet",
|
||||
"name": "DealSet",
|
||||
"component": "/malls/set/deal",
|
||||
"meta": {
|
||||
"title": "MallsManage",
|
||||
"isOnly": false,
|
||||
"auth": [],
|
||||
"pagePermission": [{
|
||||
"title": "DealSet",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"path": "virtualPayment",
|
||||
"name": "VirtualPaymentSet",
|
||||
"component": "/malls/set/payment",
|
||||
"meta": {
|
||||
"title": "MallsManage",
|
||||
"isOnly": false,
|
||||
"auth": [],
|
||||
"pagePermission": [{
|
||||
"title": "VirtualPaymentSet",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"path": "banner",
|
||||
"name": "MallsBanner",
|
||||
"component": "/malls/set/banner",
|
||||
"meta": {
|
||||
"keepAlive": true,
|
||||
"title": "MallsManage",
|
||||
"isOnly": false,
|
||||
"auth": [],
|
||||
"pagePermission": [{
|
||||
"title": "MallsBanner",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"path": "editBanner",
|
||||
"name": "EditBanner",
|
||||
"component": "/malls/set/editBanner",
|
||||
"meta": {
|
||||
"title": "MallsManage",
|
||||
"isOnly": false,
|
||||
"auth": [],
|
||||
"pagePermission": [{
|
||||
"title": "EditBanner",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"path": "staffGoods",
|
||||
"name": "StaffChoiceGoods",
|
||||
"component": "/malls/set/staffGoods",
|
||||
"meta": {
|
||||
"title": "MallsManage",
|
||||
"isOnly": false,
|
||||
"auth": [],
|
||||
"pagePermission": [{
|
||||
"title": "StaffChoiceGoods",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"path": "profit",
|
||||
"component": "/malls/distribution/profit",
|
||||
"name": "ProfitInfo",
|
||||
"meta": {
|
||||
"title": "MallsManage",
|
||||
"auth": [],
|
||||
"isOnly": false,
|
||||
"keepAlive": true,
|
||||
"pagePermission": [{
|
||||
"title": "ProfitInfo",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"path": "commission",
|
||||
"component": "/malls/distribution/commission",
|
||||
"name": "CommissionInfo",
|
||||
"meta": {
|
||||
"title": "MallsManage",
|
||||
"auth": [],
|
||||
"isOnly": false,
|
||||
"keepAlive": true,
|
||||
"pagePermission": [{
|
||||
"title": "CommissionInfo",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"path": "cash",
|
||||
"component": "/malls/distribution/takeCash",
|
||||
"name": "TakeCashInfo",
|
||||
"meta": {
|
||||
"title": "MallsManage",
|
||||
"auth": [],
|
||||
"isOnly": false,
|
||||
"keepAlive": true,
|
||||
"pagePermission": [{
|
||||
"title": "TakeCashInfo",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"path": "relation",
|
||||
"component": "/malls/distribution/relation",
|
||||
"name": "DistributionRelation",
|
||||
"meta": {
|
||||
"title": "MallsManage",
|
||||
"auth": [],
|
||||
"isOnly": false,
|
||||
"keepAlive": true,
|
||||
"pagePermission": [{
|
||||
"title": "DistributionRelation",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"path": "disSet",
|
||||
"component": "/malls/distribution/set",
|
||||
"name": "DistributionSetting",
|
||||
"meta": {
|
||||
"title": "MallsManage",
|
||||
"auth": [],
|
||||
"isOnly": false,
|
||||
"pagePermission": [{
|
||||
"title": "DistributionSetting",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"path": "disCash",
|
||||
"component": "/malls/distribution/cash",
|
||||
"name": "DistributionCash",
|
||||
"meta": {
|
||||
"title": "MallsManage",
|
||||
"auth": [],
|
||||
"isOnly": false,
|
||||
"pagePermission": [{
|
||||
"title": "DistributionCash",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}, {
|
||||
"path": "disaudit",
|
||||
"component": "/malls/distribution/audit",
|
||||
"name": "DistributionAudit",
|
||||
"meta": {
|
||||
"title": "MallsManage",
|
||||
"auth": [],
|
||||
"isOnly": false,
|
||||
"pagePermission": [{
|
||||
"title": "DistributionAudit",
|
||||
"index": 0,
|
||||
"auth": ["view", "add", "edit", "del", "outport"]
|
||||
}]
|
||||
}
|
||||
}]
|
||||
}
|
||||
|
||||
MALLS;
|
||||
|
||||
//return json_decode($menu, true) ;
|
||||
|
||||
return ["shop" => $malls];
|
||||
|
||||
|
||||
51
app/massage/info/DiyCompoents.php
Normal file
51
app/massage/info/DiyCompoents.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: shuixian
|
||||
* Date: 2019/11/20
|
||||
* Time: 18:29
|
||||
*/
|
||||
|
||||
|
||||
$goods = <<<GOODS
|
||||
{
|
||||
"title":"商品列表",
|
||||
"type":"goodsList",
|
||||
"icon":"iconGoodsList",
|
||||
"isDelete":true,
|
||||
"addNumber":1,
|
||||
"attr":[
|
||||
],
|
||||
"data":{
|
||||
"title":"商品列表",
|
||||
"isShowPush":false,
|
||||
"limit":""
|
||||
},
|
||||
"dataList":[
|
||||
]
|
||||
}
|
||||
|
||||
GOODS;
|
||||
|
||||
$search = <<<SEARCH
|
||||
{"title":"搜索栏","type":"search","iconPath":"iconsousuo","isDelete":true,"addNumber":1,"attr":[{"title":"是否显示分类","type":"Switch","name":"isShowCateAll"}],"data":{"placeholder":"请输入搜索内容","isShowCateAll":true}}
|
||||
|
||||
SEARCH;
|
||||
|
||||
//模块组件 后台DIY页面的左侧
|
||||
return [
|
||||
|
||||
[
|
||||
"title" => "业务组件",
|
||||
|
||||
'type' => 'shopCompoent',
|
||||
|
||||
'data' =>[
|
||||
|
||||
json_decode($search, true),
|
||||
|
||||
json_decode($goods, true),
|
||||
|
||||
]
|
||||
],
|
||||
];
|
||||
276
app/massage/info/DiyDefaultCompoents.php
Normal file
276
app/massage/info/DiyDefaultCompoents.php
Normal file
@@ -0,0 +1,276 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: shuixian
|
||||
* Date: 2019/11/20
|
||||
* Time: 18:29
|
||||
*/
|
||||
|
||||
|
||||
$defaultPage=<<<DEFAULT
|
||||
|
||||
{
|
||||
"key": 2,
|
||||
"list": [{
|
||||
"title": "搜索栏",
|
||||
"type": "search",
|
||||
"iconPath": "iconsousuo",
|
||||
"isDelete": true,
|
||||
"addNumber": 1,
|
||||
"attr": [{
|
||||
"title": "是否显示全部分类",
|
||||
"type": "Switch",
|
||||
"name": "isShowCateAll"
|
||||
}],
|
||||
"data": {
|
||||
"placeholder": "请输入搜索内容",
|
||||
"isShowCateAll": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "轮播图",
|
||||
"type": "banner",
|
||||
"icon": "iconlunbo",
|
||||
"isDelete": true,
|
||||
"addNumber": 9999,
|
||||
"attr": [{
|
||||
"title": "选择模板",
|
||||
"type": "ChooseModule",
|
||||
"name": "bannerName",
|
||||
"data": [{
|
||||
"title": "通屏轮播",
|
||||
"name": "banner-tongping",
|
||||
"img": "http://longbingcdn.xiaochengxucms.com/admin/diy/banner-tongping.png"
|
||||
}]
|
||||
},
|
||||
{
|
||||
"title": "图片列表",
|
||||
"type": "ImageLink",
|
||||
"name": "bannerList",
|
||||
"isDraggable": true,
|
||||
"isDelete": true,
|
||||
"data": [{
|
||||
"title": "图片",
|
||||
"type": "UploadImage",
|
||||
"name": "img",
|
||||
"desc": "750*350"
|
||||
},
|
||||
{
|
||||
"title": "链接类型",
|
||||
"type": "Select",
|
||||
"name": "linkType",
|
||||
"data": [{
|
||||
"label": "小程序内部页面",
|
||||
"value": 4
|
||||
},
|
||||
{
|
||||
"label": "其他小程序",
|
||||
"value": 2
|
||||
},
|
||||
{
|
||||
"label": "跳转网页",
|
||||
"value": 3
|
||||
},
|
||||
{
|
||||
"label": "拨打电话",
|
||||
"value": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "链接地址",
|
||||
"type": "Tag",
|
||||
"name": "link"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "添加模板",
|
||||
"type": "Add",
|
||||
"name": "addMouduleName",
|
||||
"addNumber": 10,
|
||||
"data": [{
|
||||
"link": [{
|
||||
"title": ""
|
||||
}],
|
||||
"linkType": 4,
|
||||
"img": [{
|
||||
"url": "http://longbingcdn.xiaochengxucms.com/admin/diy/default.png"
|
||||
}]
|
||||
}]
|
||||
}
|
||||
],
|
||||
"data": {
|
||||
"style": {
|
||||
"height": 350,
|
||||
"whiteSpace": 0,
|
||||
"wingBlank": 0
|
||||
},
|
||||
"bannerName": "banner-tongping",
|
||||
"addMouduleName": "bannerList",
|
||||
"bannerList": []
|
||||
},
|
||||
"id": 1591856492396,
|
||||
"compontents": "base"
|
||||
},
|
||||
{
|
||||
"title": "导航",
|
||||
"type": "column",
|
||||
"icon": "icondaohang1",
|
||||
"isDelete": true,
|
||||
"addNumber": 9999,
|
||||
"attr": [{
|
||||
"title": "多少行",
|
||||
"type": "InputNumber",
|
||||
"name": "row"
|
||||
},
|
||||
{
|
||||
"title": "每行多少列",
|
||||
"type": "InputNumber",
|
||||
"name": "col"
|
||||
},
|
||||
{
|
||||
"title": "图片列表",
|
||||
"type": "ImageLink",
|
||||
"name": "columnList",
|
||||
"isDraggable": true,
|
||||
"isDelete": true,
|
||||
"data": [{
|
||||
"title": "按钮文字",
|
||||
"type": "Input",
|
||||
"name": "title"
|
||||
},
|
||||
{
|
||||
"title": "图片",
|
||||
"type": "UploadImage",
|
||||
"name": "img",
|
||||
"desc": "100*100"
|
||||
},
|
||||
{
|
||||
"title": "链接类型",
|
||||
"type": "Select",
|
||||
"name": "linkType",
|
||||
"data": [{
|
||||
"label": "小程序内部页面",
|
||||
"value": 4
|
||||
},
|
||||
{
|
||||
"label": "其他小程序",
|
||||
"value": 2
|
||||
},
|
||||
{
|
||||
"label": "跳转网页",
|
||||
"value": 3
|
||||
},
|
||||
{
|
||||
"label": "拨打电话",
|
||||
"value": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "链接地址",
|
||||
"type": "Tag",
|
||||
"name": "link"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "添加模板",
|
||||
"type": "Add",
|
||||
"name": "addMouduleName",
|
||||
"addNumber": 16,
|
||||
"data": [{
|
||||
"link": [{
|
||||
"title": ""
|
||||
}],
|
||||
"linkType": 4,
|
||||
"img": [{
|
||||
"url": "http://longbingcdn.xiaochengxucms.com/admin/diy/default.png"
|
||||
}]
|
||||
}]
|
||||
}
|
||||
],
|
||||
"data": {
|
||||
"row": {
|
||||
"number": 2,
|
||||
"min": 1,
|
||||
"max": 2
|
||||
},
|
||||
"col": {
|
||||
"number": 4,
|
||||
"min": 4,
|
||||
"max": 5
|
||||
},
|
||||
"style": {
|
||||
"fontColor": "#666",
|
||||
"background": "#ffffff",
|
||||
"whiteSpace": 30,
|
||||
"wingBlank": 0
|
||||
},
|
||||
"addMouduleName": "columnList",
|
||||
"columnList": []
|
||||
},
|
||||
"id": 1591856495749,
|
||||
"compontents": "base"
|
||||
},
|
||||
{
|
||||
"title": "卡券",
|
||||
"type": "couponList",
|
||||
"icon": "iconCouponList",
|
||||
"isDelete": true,
|
||||
"addNumber": 1,
|
||||
"attr": [{
|
||||
"title": "模板名称",
|
||||
"type": "Input",
|
||||
"name": "title",
|
||||
"maxLength": 10
|
||||
},
|
||||
{
|
||||
"title": "卡券样式",
|
||||
"type": "Radio",
|
||||
"name": "type",
|
||||
"data": [{
|
||||
"label": 1,
|
||||
"title": "弹窗样式"
|
||||
},
|
||||
{
|
||||
"label": 2,
|
||||
"title": "列表样式"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"data": {
|
||||
"title": "领取卡券",
|
||||
"type": 2,
|
||||
"dataList": []
|
||||
},
|
||||
"id": 1591856498485,
|
||||
"compontents": "operate"
|
||||
},
|
||||
{
|
||||
"title": "商品列表",
|
||||
"type": "goodsList",
|
||||
"icon": "iconGoodsList",
|
||||
"isDelete": true,
|
||||
"addNumber": 1,
|
||||
"attr": [],
|
||||
"data": {
|
||||
"title": "商品列表",
|
||||
"limit": "",
|
||||
"dataList": []
|
||||
},
|
||||
"id": 1591856499273,
|
||||
"compontents": "shopCompoent"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
DEFAULT;
|
||||
|
||||
|
||||
$pages = json_decode( $defaultPage , true);
|
||||
|
||||
|
||||
return $pages;
|
||||
46
app/massage/info/DiyLink.php
Normal file
46
app/massage/info/DiyLink.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: shuixian
|
||||
* Date: 2019/11/20
|
||||
* Time: 18:29
|
||||
*/
|
||||
|
||||
|
||||
|
||||
//模块组件 后台DIY页面的左侧
|
||||
return [
|
||||
//链接类型
|
||||
[
|
||||
'key' => 2,
|
||||
"title" => "商城",
|
||||
"type" => "shop",
|
||||
"data" => [
|
||||
[
|
||||
//接口请求路径 api_path 不为空, 返回 page + '?' 数据参数
|
||||
"api_path" => "/diy/admin/Module/functionPage",
|
||||
//已经取消了
|
||||
//"params"=>"{"page" : "PAGE", "page_count" : "PAGE_COUNT"}",
|
||||
"title" => "功能页面",
|
||||
//小程序路径
|
||||
"page" => "common_page"
|
||||
],[
|
||||
//接口请求路径 api_path 不为空, 返回 page + '?' 数据参数
|
||||
"api_path" => "/shop/admin/AdminShopType/cateInfoPage",
|
||||
//已经取消了
|
||||
//"params"=>"{"page" : "PAGE", "page_count" : "PAGE_COUNT"}",
|
||||
"title" => "商品分类页面",
|
||||
//小程序路径
|
||||
"page" => "/shop/pages/filter"
|
||||
],[
|
||||
//接口请求路径 api_path 不为空, 返回 page + '?' 数据参数
|
||||
"api_path" => "/shop/admin/AdminShopGoods/goodsInfoPage",
|
||||
//已经取消了
|
||||
//"params"=>"{"page" : "PAGE", "page_count" : "PAGE_COUNT"}",
|
||||
"title" => "商品详情页面",
|
||||
//小程序路径
|
||||
"page" => "/pages/shop/detail"
|
||||
],
|
||||
]
|
||||
],
|
||||
];
|
||||
42
app/massage/info/DiyTabbar.php
Normal file
42
app/massage/info/DiyTabbar.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: shuixian
|
||||
* Date: 2019/11/20
|
||||
* Time: 18:29
|
||||
*/
|
||||
|
||||
|
||||
//底部菜单自定义
|
||||
return [
|
||||
[
|
||||
//底部菜单编号
|
||||
'key' => 2 ,
|
||||
//是否显示
|
||||
'is_show' => 1 ,
|
||||
//图标
|
||||
'iconPath' => 'icon-shangcheng1',
|
||||
//选中图标样式
|
||||
'selectedIconPath' => 'icon-shangcheng',
|
||||
//那个页面 英文名称
|
||||
'pageComponents' => 'shopHome',
|
||||
//名称
|
||||
'name' => '商城',
|
||||
'url' => '',
|
||||
'url_jump_way' => '0',
|
||||
'url_out' => '',
|
||||
'is_delete' => false ,
|
||||
'bind_compoents'=>[
|
||||
'base',
|
||||
'shopCompoent',
|
||||
'operate'
|
||||
],
|
||||
|
||||
'bind_links' => [
|
||||
|
||||
'shop'
|
||||
],
|
||||
'page'=> []
|
||||
],
|
||||
|
||||
];
|
||||
86
app/massage/info/FunctionPage.php
Normal file
86
app/massage/info/FunctionPage.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: shuixian
|
||||
* Date: 2019/11/20
|
||||
* Time: 18:29
|
||||
*/
|
||||
|
||||
|
||||
|
||||
//模块组件 后台DIY页面的左侧
|
||||
$tmp = [
|
||||
//链接类型
|
||||
|
||||
[
|
||||
'id'=>'',
|
||||
|
||||
'level'=>1,
|
||||
|
||||
'key'=> 2,
|
||||
//"params"=>"{"page" : "PAGE", "page_count" : "PAGE_COUNT"}",
|
||||
"title" => "商城页面",
|
||||
//小程序路径
|
||||
"path" => "/pages/user/home?key=2&staff_id="
|
||||
],[
|
||||
'id'=>'',
|
||||
|
||||
'level'=>2,
|
||||
|
||||
'key'=> 2,
|
||||
//"params"=>"{"page" : "PAGE", "page_count" : "PAGE_COUNT"}",
|
||||
"title" => "商城购物车",
|
||||
//小程序路径
|
||||
"path" => "/shop/pages/cart"
|
||||
],[
|
||||
'id'=>'',
|
||||
|
||||
'level'=>2,
|
||||
|
||||
'key'=> 2,
|
||||
//"params"=>"{"page" : "PAGE", "page_count" : "PAGE_COUNT"}",
|
||||
"title" => "商城卡券列表",
|
||||
//小程序路径
|
||||
"path" => "/shop/pages/coupon/receive?staff_id="
|
||||
],
|
||||
|
||||
[
|
||||
'id'=>'',
|
||||
|
||||
'level'=>2,
|
||||
|
||||
'key'=> 2,
|
||||
//"params"=>"{"page" : "PAGE", "page_count" : "PAGE_COUNT"}",
|
||||
"title" => "商城全部分类",
|
||||
//小程序路径
|
||||
"path" => "/shop/pages/cate"
|
||||
],
|
||||
[
|
||||
'id'=>'',
|
||||
|
||||
'level'=>2,
|
||||
|
||||
'key'=> 2,
|
||||
//"params"=>"{"page" : "PAGE", "page_count" : "PAGE_COUNT"}",
|
||||
"title" => "商城采购模版",
|
||||
//小程序路径
|
||||
"path" => "/shop/pages/purchase/list?staff_id="
|
||||
],
|
||||
[
|
||||
'id'=>'',
|
||||
|
||||
'level'=>2,
|
||||
|
||||
'key'=> 2,
|
||||
//"params"=>"{"page" : "PAGE", "page_count" : "PAGE_COUNT"}",
|
||||
"title" => "商城砍价列表页",
|
||||
//小程序路径
|
||||
"path" => "/shop/pages/bargain/list?staff_id="
|
||||
],
|
||||
|
||||
|
||||
|
||||
];
|
||||
|
||||
|
||||
return $tmp;
|
||||
32
app/massage/info/Info.php
Normal file
32
app/massage/info/Info.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: shuixian
|
||||
* Date: 2019/11/20
|
||||
* Time: 18:30
|
||||
*/
|
||||
|
||||
return [
|
||||
|
||||
//模块名称[必填]
|
||||
'name' => 'massage',
|
||||
//模块标题[必填]
|
||||
'title' =>'商城',
|
||||
//内容简介
|
||||
'desc' =>'',
|
||||
//封面图标
|
||||
'icon' =>'',
|
||||
//模块类型[必填] model:模块 可以出现在左侧一级 app:应用中心 , 是一个应用中心的应用
|
||||
'type' => 'model',
|
||||
// 模块唯一标识[必填],格式:模块名.开发者标识.module
|
||||
'identifier' => 'shop.longbing.module',
|
||||
// 版本[必填],格式采用三段式:主版本号.次版本号.修订版本号
|
||||
'version' => '1.0.82',
|
||||
// 模块依赖[可选],格式[[模块名, 模块唯一标识, 依赖版本, 对比方式]]
|
||||
'need_module'=> [],
|
||||
// 应用依赖[可选],格式[[插件名, 应用唯一标识, 依赖版本, 对比方式]]
|
||||
'need_app' => [],
|
||||
//订阅消息
|
||||
'tmpl_name'=>['pay_order','send_order']
|
||||
|
||||
];
|
||||
106
app/massage/info/PermissionShop.php
Normal file
106
app/massage/info/PermissionShop.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | Longbing [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright Chengdu longbing Technology Co., Ltd.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Website http://longbing.org/
|
||||
// +----------------------------------------------------------------------
|
||||
// | Sales manager: +86-13558882532 / +86-13330887474
|
||||
// | Technical support: +86-15680635005
|
||||
// | After-sale service: +86-17361005938
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace app\shop\info;
|
||||
|
||||
use longbingcore\permissions\PermissionAbstract;
|
||||
|
||||
/**
|
||||
* 商城模块功能权限
|
||||
* Class PermissionAppstore
|
||||
*/
|
||||
class PermissionShop extends PermissionAbstract {
|
||||
|
||||
const tabbarKey = null;
|
||||
//后台管理菜单对应key[必填] , 当前模块文件夹名称
|
||||
const adminMenuKey = 'shop';
|
||||
public $saasKey ;
|
||||
const apiPaths = [];
|
||||
|
||||
|
||||
public function __construct(int $uniacid,$infoConfigOptions = [])
|
||||
{
|
||||
$this->saasKey = longbing_get_auth_prefix('AUTH_SHOP') ;
|
||||
parent::__construct($uniacid, self::tabbarKey, self::adminMenuKey, $this->saasKey, self::apiPaths , $infoConfigOptions);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 返回saas端授权结果
|
||||
* @return bool
|
||||
*/
|
||||
public function sAuth(): bool
|
||||
{
|
||||
if(!$this->getAuthIsSaasCheck()){
|
||||
return true ;
|
||||
}
|
||||
return $this->sassValue == 1 ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回p端授权结果
|
||||
* @return bool
|
||||
*/
|
||||
public function pAuth(): bool
|
||||
{
|
||||
if (!$this->sAuth()) {
|
||||
return false;
|
||||
};
|
||||
|
||||
//代理管理端可以控制商城是否展示权限 , 这里需要判断权限
|
||||
$pAuthConfig = $this->getPAuthConfig();
|
||||
//必须平台授权才能使用
|
||||
|
||||
//dump($this->getAuthIsPlatformCheck());exit;
|
||||
if($this->getAuthIsPlatformCheck()){
|
||||
//根据授权而定
|
||||
if ($pAuthConfig ){
|
||||
|
||||
// dump($pAuthConfig);exit;
|
||||
return $pAuthConfig['shop_switch'] ? true : false ;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回c端授权结果
|
||||
*
|
||||
* @param int $user_id
|
||||
* @return bool
|
||||
* @author ArtizanZhang
|
||||
* @DataTime: 2019/12/9 17:13
|
||||
*/
|
||||
public function cAuth(int $user_id): bool
|
||||
{
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加商品数量
|
||||
*
|
||||
* @author shuixian
|
||||
* @DataTime: 2019/12/19 19:02
|
||||
*/
|
||||
public function getAddGoodsNumber(){
|
||||
return $this->getAuthVaule( longbing_get_auth_prefix('AUTH_GOODS') , 4);
|
||||
|
||||
}
|
||||
}
|
||||
204
app/massage/info/RadarMessage.php
Normal file
204
app/massage/info/RadarMessage.php
Normal file
@@ -0,0 +1,204 @@
|
||||
<?php
|
||||
$radar_msg = [
|
||||
[
|
||||
"sign"=> "copy",
|
||||
"type"=> 8,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请及时留意雷达动态",
|
||||
"operation"=> "咨询",
|
||||
"item"=> "产品",
|
||||
"show_count"=> 1,
|
||||
"table_name"=> "",
|
||||
"field"=> "",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 1,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请尽快把握商机",
|
||||
"operation"=> "浏览",
|
||||
"item"=> "商城列表",
|
||||
"show_count"=> 1,
|
||||
"table_name"=> "longbing_card_shop_type",
|
||||
"field"=> "title",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 2,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请尽快把握商机,主动提供细致的商品讲解将大大有利于成交",
|
||||
"operation"=> "正在查看",
|
||||
"item"=> "商品",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "longbing_card_goods",
|
||||
"field"=> "name",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 11,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请尽快把握商机",
|
||||
"operation"=> "浏览",
|
||||
"item"=> "商品分类列表",
|
||||
"show_count"=> 1,
|
||||
"table_name"=> "longbing_card_shop_type",
|
||||
"field"=> "title",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 19,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请前往订单中心查看详情",
|
||||
"operation"=> "订单商品已发货,系统订单号为:",
|
||||
"item"=> "",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "longbing_card_shop_order",
|
||||
"field"=> "out_trade_no",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 20,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请前往订单中心查看详情",
|
||||
"operation"=> "自提商品已提货",
|
||||
"item"=> "",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "longbing_card_shop_order",
|
||||
"field"=> "out_trade_no",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 21,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请等待管理员审核并注意查收",
|
||||
"operation"=> "已申请退款",
|
||||
"item"=> "",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "longbing_card_shop_order",
|
||||
"field"=> "out_trade_no",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 22,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请前往订单中心查看详情",
|
||||
"operation"=> "已取消申请退款",
|
||||
"item"=> "",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "longbing_card_shop_order",
|
||||
"field"=> "out_trade_no",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 23,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请前往订单中心查看详情",
|
||||
"operation"=> "管理员拒绝退款",
|
||||
"item"=> "",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "longbing_card_shop_order",
|
||||
"field"=> "out_trade_no",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "view",
|
||||
"type"=> 24,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请注意查收",
|
||||
"operation"=> "退款成功",
|
||||
"item"=> "",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "longbing_card_shop_order",
|
||||
"field"=> "out_trade_no",
|
||||
"send"=> 1,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "order",
|
||||
"type"=> 1,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请在订单中心查看详情",
|
||||
"operation"=> "已购买商品",
|
||||
"item"=> "",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "longbing_card_shop_order",
|
||||
"field"=> "out_trade_no",
|
||||
"send"=> 2,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "order",
|
||||
"type"=> 2,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请在订单中心查看详情",
|
||||
"operation"=> "已参与拼团",
|
||||
"item"=> "",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "longbing_card_shop_order",
|
||||
"field"=> "out_trade_no",
|
||||
"send"=> 2,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
[
|
||||
"sign"=> "order",
|
||||
"type"=> 3,
|
||||
"max"=> 0,
|
||||
"pid"=> 0,
|
||||
"msg"=> "请在预约订单中心查看详情",
|
||||
"operation"=> "预约了",
|
||||
"item"=> "服务",
|
||||
"show_count"=> 0,
|
||||
"table_name"=> "lb_appoint_record",
|
||||
"field"=> "name,phone,project_id,start_time,remark",
|
||||
"send"=> 2,
|
||||
"uniacid"=> 2,
|
||||
"status"=> 1
|
||||
],
|
||||
|
||||
|
||||
];
|
||||
|
||||
return $radar_msg;
|
||||
2144
app/massage/info/UpdateSql.php
Normal file
2144
app/massage/info/UpdateSql.php
Normal file
File diff suppressed because it is too large
Load Diff
15
app/massage/lang/zh-cn.php
Normal file
15
app/massage/lang/zh-cn.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
return [
|
||||
'not find refundorder' => '未找到退款订单',
|
||||
'not find order' => '未找到订单',
|
||||
'status is error' => '状态错误',
|
||||
'Too little money' => '体现金额不得小于平台最低提现金额',
|
||||
'no profit' => '未找到佣金记录',
|
||||
'Insufficient amount' => '佣金不足',
|
||||
'no data' => '未找到记录',
|
||||
'not data' => '未找到记录',
|
||||
'Only offline package can be cancelled' => '只有线下福包才能核销',
|
||||
'The coupon has expired'=> '福包已过期',
|
||||
'not find card' => '名片没有找到',
|
||||
'no config of pay' => '未配置支付信息',
|
||||
];
|
||||
91
app/massage/model/Address.php
Normal file
91
app/massage/model/Address.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class Address extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'lbfarm_address';
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page){
|
||||
|
||||
$data = $this->where($dis)->order('status desc,id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-19 16:08
|
||||
* @功能说明:开启默认
|
||||
*/
|
||||
public function updateOne($id){
|
||||
|
||||
$user_id = $this->where(['id'=>$id])->value('user_id');
|
||||
|
||||
$res = $this->where(['user_id'=>$user_id])->where('id','<>',$id)->update(['status'=>0]);
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
75
app/massage/model/Admin.php
Normal file
75
app/massage/model/Admin.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class Admin extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'shequshop_school_admin';
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page){
|
||||
|
||||
$data = $this->where($dis)->order('id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
91
app/massage/model/Article.php
Normal file
91
app/massage/model/Article.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class Article extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'shequshop_school_article';
|
||||
|
||||
|
||||
protected $append = [
|
||||
|
||||
'create_time_text'
|
||||
];
|
||||
|
||||
public function getCreateTimeTextAttr($value,$data){
|
||||
|
||||
if(!empty($data['create_time'])){
|
||||
|
||||
return date('Y.m.d H:i',$data['create_time']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$data['create_time'] = time();
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page=10){
|
||||
|
||||
$data = $this->where($dis)->order('top desc,id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
93
app/massage/model/BalanceCard.php
Normal file
93
app/massage/model/BalanceCard.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class BalanceCard extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'massage_service_balance_card';
|
||||
|
||||
//
|
||||
// protected $append = [
|
||||
//
|
||||
// 'spe_list',
|
||||
//
|
||||
// 'all_stock',
|
||||
//
|
||||
// 'show_price'
|
||||
//
|
||||
// ];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$data['create_time'] = time();
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page=10){
|
||||
|
||||
$data = $this->where($dis)->order('top desc,id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
256
app/massage/model/BalanceOrder.php
Normal file
256
app/massage/model/BalanceOrder.php
Normal file
@@ -0,0 +1,256 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use app\member\model\Level;
|
||||
use app\member\model\Rights;
|
||||
use longbingcore\wxcore\PospalApi;
|
||||
use think\facade\Db;
|
||||
|
||||
class BalanceOrder extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'massage_service_balance_order_list';
|
||||
|
||||
//
|
||||
protected $append = [
|
||||
|
||||
'nick_name',
|
||||
|
||||
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-11 15:47
|
||||
* @功能说明:用户昵称
|
||||
*/
|
||||
public function getNickNameAttr($value,$data){
|
||||
|
||||
if(!empty($data['user_id'])){
|
||||
|
||||
$user_model = new User();
|
||||
|
||||
return $user_model->where(['id'=>$data['user_id']])->value('nickName');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$data['status'] = 1;
|
||||
|
||||
$data['create_time'] = time();
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page=10){
|
||||
|
||||
$data = $this->where($dis)->order('id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-22 11:31
|
||||
* @功能说明:订单支付回调
|
||||
*/
|
||||
public function orderResult($order_code,$transaction_id){
|
||||
|
||||
$order = $this->dataInfo(['order_code'=>$order_code]);
|
||||
|
||||
if(!empty($order)&&$order['status']==1){
|
||||
|
||||
$user_model = new User();
|
||||
|
||||
$water_model= new BalanceWater();
|
||||
|
||||
$user = $user_model->dataInfo(['id'=>$order['user_id']]);
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
$update = [
|
||||
|
||||
'transaction_id' => $transaction_id,
|
||||
|
||||
'status' => 2,
|
||||
|
||||
'pay_time' => time(),
|
||||
|
||||
'now_balance' => $order['true_price']+$user['balance']
|
||||
|
||||
];
|
||||
//修改订单信息
|
||||
$res = $this->dataUpdate(['id'=>$order['id']],$update);
|
||||
|
||||
if($res==0){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
}
|
||||
|
||||
$update = [
|
||||
|
||||
'balance' => $order['true_price']+$user['balance'],
|
||||
|
||||
'member_level' => $order['member_level'],
|
||||
|
||||
'vip_time' => $user['vip_time']==0?time():0
|
||||
|
||||
];
|
||||
//修改用户余额
|
||||
$res = $user_model->dataUpdate(['id'=>$order['user_id']],$update);
|
||||
|
||||
if($res==0){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
}
|
||||
//添加余额流水
|
||||
$insert = [
|
||||
|
||||
'uniacid' => $order['uniacid'],
|
||||
|
||||
'user_id' => $order['user_id'],
|
||||
|
||||
'price' => $order['true_price'],
|
||||
|
||||
'order_id'=> $order['id'],
|
||||
|
||||
'add' => 1,
|
||||
|
||||
'type' => 1,
|
||||
|
||||
'before_balance' => $user['balance'],
|
||||
|
||||
'after_balance' => $order['true_price']+$user['balance'],
|
||||
];
|
||||
|
||||
$res = $water_model->dataAdd($insert);
|
||||
|
||||
if($res==0){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
}
|
||||
//给会员权益
|
||||
if(!empty($order['member_level'])){
|
||||
|
||||
$rights_model = new Rights();
|
||||
|
||||
$rights_model->giveRights($order['member_level'],$order['user_id'],$order['id']);
|
||||
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
//向银豹同步会员
|
||||
if(!empty($order['member_level'])){
|
||||
|
||||
$level_model = new Level();
|
||||
|
||||
$api_model = new PospalApi();
|
||||
|
||||
$level = $level_model->levelInfo(['id'=>$order['member_level']]);
|
||||
|
||||
$nickName = $user_model->where(['id'=>$order['user_id']])->value('nickName');
|
||||
|
||||
$insert = [
|
||||
|
||||
'categoryName' => $level['title'],
|
||||
|
||||
'discount' => $level['discount'],
|
||||
|
||||
'number' => time().rand(1,100),
|
||||
|
||||
'name' => !empty($nickName)?$nickName:$order['phone'],
|
||||
|
||||
'phone' => $order['phone'],
|
||||
|
||||
];
|
||||
|
||||
$res = $api_model->addMember($insert);
|
||||
|
||||
if($res['status']!='success'){
|
||||
//修改订单信息
|
||||
$this->dataUpdate(['id'=>$order['id']],['error_msg'=>$res['messages'][0]]);
|
||||
}else{
|
||||
|
||||
$this->dataUpdate(['id'=>$order['id']],['have_syn'=>1]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
221
app/massage/model/BalanceWater.php
Normal file
221
app/massage/model/BalanceWater.php
Normal file
@@ -0,0 +1,221 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use app\farm\model\BreedOrderGoods;
|
||||
use app\farm\model\ClaimOrder;
|
||||
use app\farm\model\LandOrder;
|
||||
use think\facade\Db;
|
||||
|
||||
class BalanceWater extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'massage_service_balance_water';
|
||||
|
||||
//
|
||||
protected $append = [
|
||||
|
||||
'goods_title',
|
||||
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-07 17:44
|
||||
* @功能说明:项目名称
|
||||
*/
|
||||
public function getGoodsTitleAttr($value,$data){
|
||||
|
||||
if(!empty($data['type'])&&!empty($data['order_id'])&&isset($data['add'])){
|
||||
|
||||
$balance_order_model = new BalanceOrder();
|
||||
|
||||
//
|
||||
if($data['type']==1){
|
||||
|
||||
$title = $balance_order_model->where(['id'=>$data['order_id']])->value('title');
|
||||
//认养
|
||||
}elseif($data['type']==2){
|
||||
|
||||
$order_model = new ClaimOrder();
|
||||
|
||||
$title = $order_model->where(['id'=>$data['order_id']])->column('goods_name');
|
||||
//养殖
|
||||
}elseif($data['type']==3){
|
||||
|
||||
$shop_order_model = new BreedOrderGoods();
|
||||
|
||||
$title = $shop_order_model->where(['order_id'=>$data['order_id']])->column('goods_name');
|
||||
|
||||
$title = !empty($title)?implode(',',$title):'';
|
||||
//土地
|
||||
}elseif($data['type']==4){
|
||||
|
||||
$shop_order_model = new LandOrder();
|
||||
|
||||
$title = $shop_order_model->where(['id'=>$data['order_id']])->column('massif_title');
|
||||
|
||||
}
|
||||
|
||||
return $title;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$data['create_time'] = time();
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page=10){
|
||||
|
||||
$data = $this->where($dis)->order('id desc')->paginate($page)->toArray();
|
||||
|
||||
// if(){
|
||||
//
|
||||
// }
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function indexList($dis,$page=10){
|
||||
|
||||
$data = $this->where($dis)->order('id desc')->paginate($page)->toArray();
|
||||
|
||||
if(!empty($data['data'])){
|
||||
|
||||
foreach ($data['data'] as &$v){
|
||||
|
||||
$add_text = $v['add']==1?'+':'-';
|
||||
|
||||
$buy_text = $v['add']==1?'退款':'消费';
|
||||
|
||||
if($v['type']==1){
|
||||
|
||||
$buy_text = '';
|
||||
}
|
||||
|
||||
$scene_text = $this->sceneText($v['type']);
|
||||
|
||||
$v['text'] = $scene_text.$buy_text.'【'.$v['goods_title'].'】'.$add_text.'¥'.$v['price'].'现余额¥'.$v['after_balance'];
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-11-05 09:56
|
||||
* @功能说明:
|
||||
*/
|
||||
public function sceneText($type){
|
||||
|
||||
switch ($type){
|
||||
|
||||
case 1:
|
||||
|
||||
$text = '购买储值卡';
|
||||
|
||||
break;
|
||||
case 2:
|
||||
|
||||
$text = '认养订单';
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
||||
$text = '养殖订单';
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
|
||||
$text = '土地订单';
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
$text = '购买储值卡1';
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return $text;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
75
app/massage/model/Banner.php
Normal file
75
app/massage/model/Banner.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class Banner extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'massage_service_banner';
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page){
|
||||
|
||||
$data = $this->where($dis)->order('top desc,id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
153
app/massage/model/Car.php
Normal file
153
app/massage/model/Car.php
Normal file
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class Car extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'massage_service_car';
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page){
|
||||
|
||||
$data = $this->where($dis)->order('id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-18 17:21
|
||||
* @功能说明:购物车价格
|
||||
*/
|
||||
public function carPriceAndCount($user_id,$is_car=0){
|
||||
|
||||
$list = $this->carList($user_id);
|
||||
|
||||
$data['list'] = $this->carList($user_id,$is_car);
|
||||
|
||||
if(!empty($list)){
|
||||
|
||||
$data['car_price'] = round(array_sum(array_column($list,'all_price')),2);
|
||||
|
||||
$data['total_circle'] = round(array_sum(array_column($list,'total_circle')),2);
|
||||
|
||||
$data['car_count'] = array_sum(array_column($list,'num'));
|
||||
|
||||
$data['total_discount'] = 0;
|
||||
|
||||
$data['coupon_id'] = 0;
|
||||
|
||||
}else{
|
||||
|
||||
$data['car_price'] = 0;
|
||||
|
||||
$data['car_count'] = 0;
|
||||
|
||||
$data['total_discount'] = 0;
|
||||
|
||||
$data['coupon_id'] = 0;
|
||||
|
||||
$data['total_circle'] = 0;
|
||||
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-18 17:35
|
||||
* @功能说明:购物车列表
|
||||
*/
|
||||
public function carList($user_id,$all=0){
|
||||
|
||||
$dis = [
|
||||
|
||||
'a.user_id' => $user_id,
|
||||
|
||||
|
||||
'b.status' => 1,
|
||||
|
||||
//'c.cap_id' => $cap_id
|
||||
];
|
||||
|
||||
if($all==0){
|
||||
|
||||
$dis['a.status'] = 1;
|
||||
}
|
||||
|
||||
$data = $this->alias('a')
|
||||
->join('shequshop_car_goods b','a.goods_id = b.id')
|
||||
->where($dis)
|
||||
->field('a.id,a.goods_id,a.status,a.uniacid,a.num,b.title,b.cover,b.price,ROUND(b.price*a.num,2) as all_price,ROUND(b.price*a.num,2) as true_price,ROUND(b.number*a.num,2) as total_circle,b.number as circle ')
|
||||
->group('a.id')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
97
app/massage/model/CarAtvContent.php
Normal file
97
app/massage/model/CarAtvContent.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class CarAtvContent extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'shequshop_car_atv_content';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$data['create_time'] = time();
|
||||
|
||||
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page=10,$mapor=[]){
|
||||
|
||||
$data = $this->where($dis)->order('top desc,id desc')->paginate($page)->toArray();
|
||||
|
||||
// $data = $this->alias('a')
|
||||
// ->join('massage_service_user_list b','a.user_id = b.id')
|
||||
// ->where($dis)
|
||||
// ->where(function ($query) use ($mapor){
|
||||
// $query->whereOr($mapor);
|
||||
// })
|
||||
// ->field('a.*,b.nickName')
|
||||
// ->group('a.id')
|
||||
// ->order('a.id desc')
|
||||
// ->paginate($page)
|
||||
// ->toArray();
|
||||
|
||||
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
217
app/massage/model/CarAtvList.php
Normal file
217
app/massage/model/CarAtvList.php
Normal file
@@ -0,0 +1,217 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class CarAtvList extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'shequshop_car_atv_list';
|
||||
|
||||
|
||||
|
||||
protected $append = [
|
||||
|
||||
'content'
|
||||
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-15 14:31
|
||||
* @功能说明:获取活动内容
|
||||
*/
|
||||
public function getContentAttr($value,$data){
|
||||
|
||||
if(!empty($data['id'])){
|
||||
|
||||
$content = Db::name('shequshop_car_atv_content_content')->where(['atv_id'=>$data['id']])->column('content_id');
|
||||
|
||||
return array_values($content);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$data['create_time'] = time();
|
||||
|
||||
if(isset($data['content'])){
|
||||
|
||||
$content = $data['content'];
|
||||
|
||||
unset($data['content']);
|
||||
}
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
if(!empty($content)){
|
||||
|
||||
$id = $this->getLastInsID();
|
||||
|
||||
$this->updateSome($id,$content,$data['uniacid']);
|
||||
}
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-23 18:06
|
||||
* @功能说明:根据活动时间修改活动状态
|
||||
*/
|
||||
public function initAtv(){
|
||||
|
||||
$this->where('atv_s_time','>',time())->update(['atv_status'=>1]);
|
||||
|
||||
$this->where('atv_e_time','<',time())->update(['atv_status'=>3]);
|
||||
|
||||
$this->where('atv_s_time','<',time())->where(['atv_status'=>1])->update(['atv_status'=>2]);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-15 11:22
|
||||
* @功能说明:
|
||||
*/
|
||||
public function updateSome($id,$content,$uniacid){
|
||||
|
||||
Db::name('shequshop_car_atv_content_content')->where(['atv_id'=>$id])->delete();
|
||||
|
||||
if(!empty($content)){
|
||||
|
||||
foreach ($content as $value){
|
||||
|
||||
$insert = [
|
||||
|
||||
'uniacid' => $uniacid,
|
||||
|
||||
'content_id' => $value,
|
||||
|
||||
'atv_id' => $id
|
||||
];
|
||||
|
||||
Db::name('shequshop_car_atv_content_content')->insert($insert);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-10-20 10:02
|
||||
* @功能说明:判断报名内容是否在使用
|
||||
*/
|
||||
public function atvContentIng($content_id){
|
||||
|
||||
$dis[] = ['a.status','>',-1];
|
||||
|
||||
$dis[] = ['b.content_id','=',$content_id];
|
||||
|
||||
$data = $this->alias('a')
|
||||
->join('shequshop_car_atv_content_content b','a.id = b.atv_id')
|
||||
->where($dis)
|
||||
->find();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
if(isset($data['content'])){
|
||||
|
||||
$content = $data['content'];
|
||||
|
||||
unset($data['content']);
|
||||
}
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
if(!empty($content)){
|
||||
|
||||
$id = $this->getLastInsID();
|
||||
|
||||
$this->updateSome($data['id'],$content,$data['uniacid']);
|
||||
}
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page=10,$mapor=[]){
|
||||
|
||||
$data = $this->where($dis)->order('id desc')->paginate($page)->toArray();
|
||||
|
||||
// $data = $this->alias('a')
|
||||
// ->join('massage_service_user_list b','a.user_id = b.id')
|
||||
// ->where($dis)
|
||||
// ->where(function ($query) use ($mapor){
|
||||
// $query->whereOr($mapor);
|
||||
// })
|
||||
// ->field('a.*,b.nickName')
|
||||
// ->group('a.id')
|
||||
// ->order('a.id desc')
|
||||
// ->paginate($page)
|
||||
// ->toArray();
|
||||
|
||||
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
632
app/massage/model/CarAtvRecord.php
Normal file
632
app/massage/model/CarAtvRecord.php
Normal file
@@ -0,0 +1,632 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use app\shop\model\RefundOrder;
|
||||
use think\facade\Db;
|
||||
|
||||
class CarAtvRecord extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'shequshop_car_atv_record';
|
||||
|
||||
protected $append = [
|
||||
|
||||
'content',
|
||||
|
||||
'time_text',
|
||||
|
||||
'game_info',
|
||||
|
||||
'hx_user_name'
|
||||
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-28 14:12
|
||||
* @功能说明:核销人姓名
|
||||
*/
|
||||
public function getHxUserNameAttr($value,$data){
|
||||
|
||||
if(!empty($data['hx_user'])){
|
||||
|
||||
$user_model = new User();
|
||||
|
||||
$name = $user_model->where(['id'=>$data['hx_user']])->value('nickName');
|
||||
|
||||
return $name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-27 16:21
|
||||
* @功能说明:赛事信息
|
||||
*/
|
||||
public function getGameInfoAttr($value,$data){
|
||||
|
||||
if(!empty($data['id'])){
|
||||
|
||||
$game_model = new CarGame();
|
||||
|
||||
$dis = [
|
||||
|
||||
'type' => 1,
|
||||
|
||||
'record_id' => $data['id']
|
||||
];
|
||||
|
||||
$list = $game_model->dataInfo($dis);
|
||||
|
||||
if(!empty($list)){
|
||||
|
||||
$list['best_time'] = game_time($list['best_time']);
|
||||
|
||||
$list['total_time'] = game_time($list['total_time']);
|
||||
|
||||
}
|
||||
|
||||
return $list;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @功能说明:转换时间
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-26 1 4:11
|
||||
*/
|
||||
public function getTimeTextAttr($value,$data){
|
||||
|
||||
if(!empty($data['start_time'])&&!empty($data['end_time'])){
|
||||
|
||||
$time = date('Y.m.d H:i',$data['start_time']).'-'.date('Y.m.d H:i',$data['end_time']);
|
||||
|
||||
return $time;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-15 14:31
|
||||
* @功能说明:获取活动内容
|
||||
*/
|
||||
public function getContentAttr($value,$data){
|
||||
|
||||
if(!empty($data['id'])){
|
||||
|
||||
$content = Db::name('shequshop_car_atv_record_content')->where(['record_id'=>$data['id']])->select()->toArray();
|
||||
|
||||
return array_values($content);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$data['create_time'] = time();
|
||||
|
||||
if(isset($data['content'])){
|
||||
|
||||
$content = $data['content'];
|
||||
|
||||
unset($data['content']);
|
||||
}
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
if(!empty($content)){
|
||||
|
||||
$id = $this->getLastInsID();
|
||||
|
||||
$this->updateSome($id,$content,$data['uniacid']);
|
||||
}
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-15 11:22
|
||||
* @功能说明:
|
||||
*/
|
||||
public function updateSome($id,$content,$uniacid){
|
||||
|
||||
Db::name('shequshop_car_atv_record_content')->where(['record_id'=>$id])->delete();
|
||||
|
||||
if(!empty($content)){
|
||||
|
||||
foreach ($content as $value){
|
||||
|
||||
$insert = [
|
||||
|
||||
'uniacid' => $uniacid,
|
||||
|
||||
'content_id' => $value['content_id'],
|
||||
|
||||
'content_key' => $value['content_key'],
|
||||
|
||||
'content_value' => $value['content_value'],
|
||||
|
||||
'content_type' => $value['content_type'],
|
||||
|
||||
'record_id' => $id
|
||||
];
|
||||
|
||||
Db::name('shequshop_car_atv_record_content')->insert($insert);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
if(isset($data['content'])){
|
||||
|
||||
$content = $data['content'];
|
||||
|
||||
unset($data['content']);
|
||||
}
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
if(!empty($content)){
|
||||
|
||||
$id = $this->getLastInsID();
|
||||
|
||||
$this->updateSome($data['id'],$content,$data['uniacid']);
|
||||
}
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page=10,$mapor=[]){
|
||||
|
||||
$data = $this->where($dis)->order('id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-16 13:57
|
||||
* @功能说明:成绩排行版
|
||||
*/
|
||||
public function topRecordList($dis,$page=10,$mapor=[]){
|
||||
|
||||
$data = $this->alias('a')
|
||||
->join('massage_service_user_list b','a.user_id = b.id')
|
||||
->where($dis)
|
||||
->where(function ($query) use ($mapor){
|
||||
$query->whereOr($mapor);
|
||||
})
|
||||
->field('a.*,b.nickName,b.avatarUrl')
|
||||
->group('a.id')
|
||||
->order('a.result asc,a.id desc')
|
||||
->paginate($page)
|
||||
->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-16 13:57
|
||||
* @功能说明:成绩排行版(可根据时间)
|
||||
*/
|
||||
public function timeTopRecordList($dis,$page=10,$time = 1,$mapor=[]){
|
||||
|
||||
|
||||
switch ($time){
|
||||
|
||||
case 1:
|
||||
|
||||
$time_text = 'day';
|
||||
|
||||
break;
|
||||
case 2:
|
||||
|
||||
$time_text = 'week';
|
||||
|
||||
break;
|
||||
case 3:
|
||||
|
||||
$time_text = 'month';
|
||||
|
||||
break;
|
||||
case 4:
|
||||
|
||||
$time_text = 'year';
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
$data = $this->alias('a')
|
||||
->join('massage_service_user_list b','a.user_id = b.id')
|
||||
->join('shequshop_car_game c','a.id = c.record_id')
|
||||
->where($dis)
|
||||
->whereTime('a.start_time',$time_text)
|
||||
->where(function ($query) use ($mapor){
|
||||
$query->whereOr($mapor);
|
||||
})
|
||||
->field('a.*,b.nickName')
|
||||
->group('a.id')
|
||||
->order('c.best_time asc,a.id desc')
|
||||
->paginate($page)
|
||||
->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-16 13:57
|
||||
* @功能说明:积分排行榜
|
||||
*/
|
||||
public function integralRecordList($dis,$page=10,$mapor=[]){
|
||||
|
||||
// $data = $this->alias('a')
|
||||
// ->join('massage_service_user_list b','a.user_id = b.id')
|
||||
// ->where($dis)
|
||||
// ->where(function ($query) use ($mapor){
|
||||
// $query->whereOr($mapor);
|
||||
// })
|
||||
// ->field('a.*,b.nickName,b.avatarUrl')
|
||||
// ->group('a.id')
|
||||
// ->order('a.integral desc,a.id desc')
|
||||
// ->paginate($page)
|
||||
// ->toArray();
|
||||
|
||||
|
||||
$data = $this->alias('a')
|
||||
->join('massage_service_user_list b','a.user_id = b.id')
|
||||
->join('shequshop_car_game c','a.id = c.record_id','left')
|
||||
->where($dis)
|
||||
->where('a.pay_type','>',1)
|
||||
->where(function ($query) use ($mapor){
|
||||
$query->whereOr($mapor);
|
||||
})
|
||||
->field('a.*,c.best_time as best_time,b.nickName,b.avatarUrl')
|
||||
->group('a.id')
|
||||
->order(['a.integral desc','a.pay_type desc','c.best_time','a.id desc'])
|
||||
->paginate($page)
|
||||
->toArray();
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-16 13:57
|
||||
* @功能说明:记录列表
|
||||
*/
|
||||
public function recordList($dis,$page=10,$mapor=[]){
|
||||
|
||||
$data = $this->alias('a')
|
||||
->join('massage_service_user_list b','a.user_id = b.id')
|
||||
->where($dis)
|
||||
->where(function ($query) use ($mapor){
|
||||
$query->whereOr($mapor);
|
||||
})
|
||||
->field('a.*,b.nickName')
|
||||
->group('a.id')
|
||||
->order('a.id desc')
|
||||
->paginate($page)
|
||||
->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-10-19 17:58
|
||||
* @功能说明:获取排名
|
||||
*/
|
||||
public function getRecordTop($record){
|
||||
|
||||
$dis = [
|
||||
|
||||
'a.atv_id' => $record['atv_id']
|
||||
];
|
||||
|
||||
$data = $this->alias('a')
|
||||
->join('shequshop_car_game c','a.id = c.record_id')
|
||||
->where($dis)
|
||||
->field('a.id')
|
||||
->group('a.id')
|
||||
->order(['a.integral desc','a.pay_type desc','c.best_time','a.id desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
$top = 0;
|
||||
|
||||
if(!empty($data)){
|
||||
|
||||
foreach ($data as $k=>$v){
|
||||
|
||||
if($v['id']==$record['id']){
|
||||
|
||||
$top = $k+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $top;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-16 13:57
|
||||
* @功能说明:记录列表
|
||||
*/
|
||||
public function atvRecordList($dis,$page=10,$mapor=[],$rank = 2){
|
||||
|
||||
$top = $rank==2?'a.integral':'a.integral desc';
|
||||
|
||||
$data = $this->alias('a')
|
||||
->join('shequshop_car_atv_list b','a.atv_id = b.id')
|
||||
->join('shequshop_car_game c','a.id = c.record_id','left')
|
||||
->where($dis)
|
||||
->where(function ($query) use ($mapor){
|
||||
$query->whereOr($mapor);
|
||||
})
|
||||
->field('a.*,b.title,b.cover,b.atv_num,b.atv_status,c.best_time as best_time,c.major')
|
||||
->group('a.id')
|
||||
->order([$top,'a.pay_type desc','c.best_time','a.id desc'])
|
||||
->paginate($page)
|
||||
->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-26 16:44
|
||||
* @功能说明:支付回调
|
||||
*/
|
||||
public function dataResult($order_code,$transaction_id){
|
||||
|
||||
$data = $this->dataInfo(['order_code'=>$order_code]);
|
||||
|
||||
if($data['pay_type']==1){
|
||||
//由于时效性问题 报名数量放到回调里面处理
|
||||
// $atv_model = new CarAtvList();
|
||||
//
|
||||
// $atv = $atv_model->dataInfo(['id'=>$data['atv_id']]);
|
||||
// //报名已经满了
|
||||
// if($atv['atv_num']<=$atv['have_num']){
|
||||
//
|
||||
// $this
|
||||
//
|
||||
//
|
||||
// //不再执行
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// $atv_model->where(['id'=>$data['atv_id']])->update(['have_num'=>Db::raw("have_num+1")]);
|
||||
|
||||
$update = [
|
||||
|
||||
'pay_type' => 2,
|
||||
|
||||
'pay_time' => time(),
|
||||
|
||||
'transaction_id' => $transaction_id
|
||||
];
|
||||
|
||||
$this->dataUpdate(['id'=>$data['id']],$update);
|
||||
//余额扣除
|
||||
if($data['balance']>0){
|
||||
|
||||
$user_model = new User();
|
||||
|
||||
$user = $user_model->dataInfo(['id'=>$data['user_id']]);
|
||||
|
||||
$balance = $user['balance'] - $data['balance'];
|
||||
|
||||
$user_model->dataUpdate(['id'=>$data['user_id']],['balance'=>$balance]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-26 17:19
|
||||
* @功能说明:取消超时未支付的
|
||||
*/
|
||||
public function autoCancelRecord($user_id=0){
|
||||
|
||||
if(!empty($user_id)){
|
||||
|
||||
$dis[] = ['user_id','=',$user_id];
|
||||
|
||||
}else{
|
||||
|
||||
$dis[] = ['over_time','<',time()];
|
||||
|
||||
}
|
||||
|
||||
$dis[] = ['pay_type','=',1];
|
||||
|
||||
$list = $this->where($dis)->select()->toArray();
|
||||
|
||||
if(!empty($list)){
|
||||
|
||||
foreach ($list as $value){
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
$res = $this->cancelRecord($value,1);
|
||||
|
||||
if(!empty($res['code'])){
|
||||
|
||||
Db::rollback();
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-26 17:19
|
||||
* @功能说明:取消超时未支付的
|
||||
*/
|
||||
public function cancelRecord($record,$auto_refund=0){
|
||||
|
||||
$atv_model = new CarAtvList();
|
||||
|
||||
$update = [
|
||||
|
||||
'pay_type' => -1,
|
||||
|
||||
'refund_time' => time(),
|
||||
|
||||
'auto_refund' => $auto_refund,
|
||||
|
||||
];
|
||||
|
||||
$res = $this->dataUpdate(['id'=>$record['id']],$update);
|
||||
|
||||
if($res==0){
|
||||
|
||||
return ['code'=>500,'msg'=>'取消失败1'];
|
||||
}
|
||||
|
||||
$atv = $atv_model->dataInfo(['id'=>$record['atv_id']]);
|
||||
|
||||
$res = $atv_model->dataUpdate(['id'=>$record['atv_id']],['have_num'=>$atv['have_num']-1]);
|
||||
|
||||
if($res==0){
|
||||
|
||||
return ['code'=>500,'msg'=>'取消失败'];
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-11-12 15:06
|
||||
* @功能说明:积分到账
|
||||
*/
|
||||
public function pointSuccess($uniacid){
|
||||
|
||||
$dis = [
|
||||
|
||||
'pay_type' => 7,
|
||||
|
||||
'have_tx' => 0,
|
||||
|
||||
'uniacid' => $uniacid
|
||||
|
||||
];
|
||||
|
||||
$order = $this->where($dis)->field('id,integral,user_id,uniacid')->select()->toArray();
|
||||
|
||||
if(!empty($order)){
|
||||
|
||||
$integral_model = new \app\member\model\Integral();
|
||||
|
||||
foreach ($order as $value){
|
||||
|
||||
//修改订单状态
|
||||
$res = $this->where(['id'=>$value['id'],'have_tx'=>0])->update(['have_tx'=>1]);
|
||||
//增加用户积分
|
||||
if($res==1){
|
||||
|
||||
$integral_model->integralUserAdd($value['user_id'],$value['integral'],$value['uniacid'],2,8,$value['id']);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
95
app/massage/model/CarDriver.php
Normal file
95
app/massage/model/CarDriver.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class CarDriver extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'shequshop_car_driver';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$data['create_time'] = time();
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page=10,$mapor=[]){
|
||||
|
||||
// $data = $this->where($dis)->order('top desc,id desc')->paginate($page)->toArray();
|
||||
|
||||
$data = $this->alias('a')
|
||||
->join('massage_service_user_list b','a.user_id = b.id')
|
||||
->where($dis)
|
||||
->where(function ($query) use ($mapor){
|
||||
$query->whereOr($mapor);
|
||||
})
|
||||
->field('a.*,b.nickName,avatarUrl')
|
||||
->group('a.id')
|
||||
->order('a.id desc')
|
||||
->paginate($page)
|
||||
->toArray();
|
||||
|
||||
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
209
app/massage/model/CarGame.php
Normal file
209
app/massage/model/CarGame.php
Normal file
@@ -0,0 +1,209 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class CarGame extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'shequshop_car_game';
|
||||
|
||||
|
||||
protected $append = [
|
||||
|
||||
'start_time_text',
|
||||
|
||||
'best_time_text',
|
||||
|
||||
'total_time_text',
|
||||
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-10-21 10:20
|
||||
* @功能说明:转换时间格式
|
||||
*/
|
||||
public function getBestTimeTextAttr($value,$data){
|
||||
|
||||
if(!empty($data['best_time'])){
|
||||
|
||||
return game_time($data['best_time']);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-10-21 10:20
|
||||
* @功能说明:转换时间格式
|
||||
*/
|
||||
public function getTotalTimeTextAttr($value,$data){
|
||||
|
||||
if(!empty($data['total_time'])){
|
||||
|
||||
return game_time($data['total_time']);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-28 11:48
|
||||
* @功能说明:转换时间格式
|
||||
*/
|
||||
public function getStartTimeTextAttr($value,$data){
|
||||
|
||||
if(!empty($data['start_time'])){
|
||||
|
||||
return date('Y.m.d H:i',$data['start_time']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$data['create_time'] = time();
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page){
|
||||
|
||||
$data = $this->where($dis)->order('id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-16 13:57
|
||||
* @功能说明:成绩排行版
|
||||
*/
|
||||
public function topRecordList($dis,$page=10,$mapor=[]){
|
||||
|
||||
$data = $this->alias('a')
|
||||
->join('massage_service_user_list b','a.user_id = b.id')
|
||||
->where($dis)
|
||||
->where(function ($query) use ($mapor){
|
||||
$query->whereOr($mapor);
|
||||
})
|
||||
->field('a.*,b.nickName,b.avatarUrl')
|
||||
->group('a.id')
|
||||
->order('a.best_time asc,a.id desc')
|
||||
->paginate($page)
|
||||
->toArray();
|
||||
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-16 13:57
|
||||
* @功能说明:成绩排行版(可根据时间)
|
||||
*/
|
||||
public function timeTopRecordList($dis,$page=10,$time = 1,$mapor=[]){
|
||||
|
||||
switch ($time){
|
||||
|
||||
case 1:
|
||||
|
||||
$time_text = 'today';
|
||||
|
||||
break;
|
||||
case 2:
|
||||
|
||||
$time_text = 'week';
|
||||
|
||||
break;
|
||||
case 3:
|
||||
|
||||
$time_text = 'month';
|
||||
|
||||
break;
|
||||
case 4:
|
||||
|
||||
$time_text = 'year';
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
$data = $this->alias('a')
|
||||
->join('massage_service_user_list b','a.user_id = b.id')
|
||||
->where($dis)
|
||||
->whereTime('a.start_time',$time_text)
|
||||
->where(function ($query) use ($mapor){
|
||||
$query->whereOr($mapor);
|
||||
})
|
||||
->field('a.*,b.nickName,b.avatarUrl')
|
||||
->group('a.id')
|
||||
->order('a.best_time asc,a.id desc')
|
||||
->paginate($page)
|
||||
->toArray();
|
||||
|
||||
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
83
app/massage/model/CarLineUp.php
Normal file
83
app/massage/model/CarLineUp.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class CarLineUp extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'shequshop_car_line_up';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$data['create_time'] = time();
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page=10){
|
||||
|
||||
$data = $this->where($dis)->order('top desc,id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
83
app/massage/model/CarPrice.php
Normal file
83
app/massage/model/CarPrice.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class CarPrice extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'massage_service_car_price';
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page){
|
||||
|
||||
$data = $this->where($dis)->order('id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
if(empty($data)){
|
||||
|
||||
$this->dataAdd($dis);
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
}
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
97
app/massage/model/CarRecordContent.php
Normal file
97
app/massage/model/CarRecordContent.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class CarRecordContent extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'shequshop_car_atv_record_content';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$data['create_time'] = time();
|
||||
|
||||
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page=10,$mapor=[]){
|
||||
|
||||
$data = $this->where($dis)->order('top desc,id desc')->paginate($page)->toArray();
|
||||
|
||||
// $data = $this->alias('a')
|
||||
// ->join('massage_service_user_list b','a.user_id = b.id')
|
||||
// ->where($dis)
|
||||
// ->where(function ($query) use ($mapor){
|
||||
// $query->whereOr($mapor);
|
||||
// })
|
||||
// ->field('a.*,b.nickName')
|
||||
// ->group('a.id')
|
||||
// ->order('a.id desc')
|
||||
// ->paginate($page)
|
||||
// ->toArray();
|
||||
|
||||
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
81
app/massage/model/CarTrophy.php
Normal file
81
app/massage/model/CarTrophy.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class CarTrophy extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'shequshop_car_trophy';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$data['create_time'] = time();
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page=10){
|
||||
|
||||
$data = $this->where($dis)->order('id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
125
app/massage/model/CarType.php
Normal file
125
app/massage/model/CarType.php
Normal file
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class CarType extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'shequshop_car_cartype';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$data['create_time'] = time();
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page=10){
|
||||
|
||||
$data = $this->where($dis)->order('top desc,id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @param $user
|
||||
* @功能说明:判断类型 专业还是普通
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-28 16:55
|
||||
*/
|
||||
public function getType($id,$user_id){
|
||||
|
||||
$data = $this->dataInfo(['id'=>$id]);
|
||||
//如果动过数据库 一律判断为普通
|
||||
if(empty($data)){
|
||||
|
||||
return 1;
|
||||
}
|
||||
//如果即选过 专业和普通 就判断用户当前身份
|
||||
if(!empty($data['major'])&&!empty($data['norm'])){
|
||||
|
||||
$driver_model = new CarDriver();
|
||||
|
||||
$user = $driver_model->dataInfo(['user_id'=>$user_id,'status'=>2]);
|
||||
|
||||
if(!empty($user)){
|
||||
|
||||
return 2;
|
||||
|
||||
}else{
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
}else{
|
||||
//就根据车型身份勾选来
|
||||
|
||||
$res = !empty($data['major'])?2:1;
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
81
app/massage/model/CarTypeConnect.php
Normal file
81
app/massage/model/CarTypeConnect.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class CarTypeConnect extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'shequshop_car_cartype_connect';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$data['create_time'] = time();
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page=10){
|
||||
|
||||
$data = $this->where($dis)->order('top desc,id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
108
app/massage/model/CarUserTrophy.php
Normal file
108
app/massage/model/CarUserTrophy.php
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class CarUserTrophy extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'shequshop_car_user_trophy';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page=10){
|
||||
|
||||
$data = $this->where($dis)->order('id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-26 16:10
|
||||
* @功能说明:用户荣誉杯
|
||||
*/
|
||||
public function userTrophy($user_id){
|
||||
|
||||
//查看荣誉杯
|
||||
$dis = [
|
||||
|
||||
'a.user_id' => $user_id,
|
||||
|
||||
'a.status' => 1,
|
||||
|
||||
'b.status' => 1,
|
||||
];
|
||||
|
||||
$data = $this->alias('a')
|
||||
->join('shequshop_car_trophy b','a.trophy_id = b.id')
|
||||
->where($dis)
|
||||
->field('a.*,b.title,b.cover')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
287
app/massage/model/Comment.php
Normal file
287
app/massage/model/Comment.php
Normal file
@@ -0,0 +1,287 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class Comment extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'massage_service_order_comment';
|
||||
|
||||
|
||||
protected $append = [
|
||||
|
||||
'lable_text',
|
||||
|
||||
'order_goods',
|
||||
|
||||
|
||||
];
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-19 17:05
|
||||
* @功能说明:子订单信息
|
||||
*/
|
||||
|
||||
public function getOrderGoodsAttr($value,$data){
|
||||
|
||||
if(!empty($data['order_id'])){
|
||||
|
||||
$order_goods_model = new OrderGoods();
|
||||
|
||||
$dis = [
|
||||
|
||||
'order_id' => $data['order_id']
|
||||
];
|
||||
|
||||
$list = $order_goods_model->where($dis)->select()->toArray();
|
||||
|
||||
return $list;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-05 23:32
|
||||
* @功能说明:标签列表
|
||||
*/
|
||||
public function getLableTextAttr($vaule,$data){
|
||||
|
||||
if(!empty($data['id'])){
|
||||
|
||||
$lable_model = new Lable();
|
||||
|
||||
$dis = [
|
||||
|
||||
'b.comment_id' => $data['id'],
|
||||
|
||||
'a.status' => 1
|
||||
|
||||
];
|
||||
$list = $lable_model->alias('a')
|
||||
->join('massage_service_comment_lable b','a.id = b.lable_id')
|
||||
->where($dis)
|
||||
->column('a.title');
|
||||
|
||||
return array_values($list);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$data['create_time'] = time();
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page=10){
|
||||
|
||||
$data = $this->alias('a')
|
||||
->join('massage_service_order_list b','a.order_id = b.id')
|
||||
->join('massage_service_order_goods_list c','a.order_id = c.order_id')
|
||||
->join('massage_service_coach_list d','b.coach_id = d.id')
|
||||
->join('massage_service_user_list e','a.user_id = e.id')
|
||||
->where($dis)
|
||||
->field('a.*,e.nickName,e.avatarUrl,c.goods_name,c.goods_cover,c.num,c.price,d.coach_name')
|
||||
->group('a.id')
|
||||
->order('a.id desc')
|
||||
->paginate($page)
|
||||
->toArray();
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
if(empty($data)){
|
||||
|
||||
$this->dataAdd($dis);
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
}
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-04-01 09:51
|
||||
* @功能说明:公众号楼长端新订单通知
|
||||
*/
|
||||
public function sendMsg($order){
|
||||
|
||||
$cap_model = new Cap();
|
||||
|
||||
$cap_id = $order['cap_id'];
|
||||
|
||||
$uniacid = $order['uniacid'];
|
||||
//获取楼长openid
|
||||
$openid = $cap_model->capOpenid($cap_id);
|
||||
|
||||
$store_name = $cap_model->where(['id'=>$cap_id])->value('store_name');
|
||||
|
||||
$access_token = longbingGetAccessToken($uniacid);
|
||||
|
||||
$config = $this->dataInfo(['uniacid'=>$uniacid]);
|
||||
|
||||
$page = "master/pages/order/list";
|
||||
//post地址
|
||||
$url = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send?access_token={$access_token}";
|
||||
|
||||
$x_config = longbingGetAppConfig($uniacid);
|
||||
|
||||
$goods_data = '';
|
||||
|
||||
$num = count($order['order_goods'])-1;
|
||||
|
||||
foreach ($order['order_goods'] as $k=>$v){
|
||||
|
||||
$icon = $k==$num?'':',';
|
||||
|
||||
$goods_data .= $v['goods_name'].'x'.$v['goods_num'].$icon;
|
||||
}
|
||||
|
||||
$order_text = !empty($order['text'])?','.$order['text']:'';
|
||||
|
||||
$address_data = $order['address_info'];
|
||||
|
||||
$data = [
|
||||
//用户小程序openid
|
||||
'touser' => $openid,
|
||||
|
||||
'mp_template_msg' => [
|
||||
//公众号appid
|
||||
'appid' => $config['app_id'],
|
||||
|
||||
"url" => "http://weixin.qq.com/download",
|
||||
//公众号模版id
|
||||
'template_id' => $config['tmp_id'],
|
||||
|
||||
'miniprogram' => [
|
||||
//小程序appid
|
||||
'appid' => $x_config['appid'],
|
||||
//跳转小程序地址
|
||||
'page' => $page,
|
||||
],
|
||||
'data' => array(
|
||||
|
||||
'first' => array(
|
||||
|
||||
'value' => $store_name.'商家,您有一笔新订单',
|
||||
|
||||
'color' => '#93c47d',
|
||||
),
|
||||
|
||||
'keyword1' => array(
|
||||
|
||||
'value' => $order['order_code'],
|
||||
|
||||
'color' => '#93c47d',
|
||||
),
|
||||
'keyword2' => array(
|
||||
//内容
|
||||
'value' => $goods_data.$order_text,
|
||||
|
||||
'color' => '#0000ff',
|
||||
),
|
||||
'keyword3' => array(
|
||||
//内容
|
||||
'value' => $order['pay_price'].'元',
|
||||
|
||||
'color' => '#0000ff',
|
||||
),
|
||||
'keyword4' => array(
|
||||
//内容
|
||||
'value' => '送货上门',
|
||||
|
||||
'color' => '#0000ff',
|
||||
),
|
||||
'keyword5' => array(
|
||||
|
||||
'value' => $address_data['user_name'].','.$address_data['mobile'].','.$address_data['address'].$address_data['address_info'],
|
||||
|
||||
'color' => '#45818e',
|
||||
),
|
||||
'remark' => array(
|
||||
//内容
|
||||
'value' => $order['order_text'],
|
||||
|
||||
'color' => '#0000ff',
|
||||
),
|
||||
)
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
$data = json_encode($data);
|
||||
|
||||
$tmp = [
|
||||
|
||||
'url' => $url,
|
||||
|
||||
'data' => $data,
|
||||
];
|
||||
$rest = lbCurlPost($tmp['url'], $tmp['data']);
|
||||
|
||||
$rest = json_decode($rest, true);
|
||||
|
||||
return $rest;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
88
app/massage/model/CommentLable.php
Normal file
88
app/massage/model/CommentLable.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class CommentLable extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'massage_service_comment_lable';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page){
|
||||
|
||||
$data = $this->where($dis)->order('top desc,id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
if(empty($data)){
|
||||
|
||||
$this->dataAdd($dis);
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
}
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
354
app/massage/model/Commission.php
Normal file
354
app/massage/model/Commission.php
Normal file
@@ -0,0 +1,354 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class Commission extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'massage_service_order_commission';
|
||||
|
||||
|
||||
|
||||
protected $append = [
|
||||
|
||||
'order_goods'
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
public function getOrderGoodsAttr($value,$data){
|
||||
|
||||
if(!empty($data['id'])){
|
||||
|
||||
$order_goods_model = new CommissionGoods();
|
||||
|
||||
$list = $order_goods_model->goodsList(['a.commission_id'=>$data['id']]);
|
||||
|
||||
return $list;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-08-25 23:24
|
||||
* @功能说明:记录
|
||||
*/
|
||||
public function recordList($dis,$page=10){
|
||||
|
||||
$data = $this->alias('a')
|
||||
->join('massage_service_user_list b','a.user_id = b.id')
|
||||
->join('massage_service_user_list c','a.top_id = c.id')
|
||||
->join('massage_service_order_list d','a.order_id = d.id')
|
||||
->where($dis)
|
||||
->field('a.*,b.nickName,c.nickName as top_name,d.order_code,d.pay_type,d.pay_price,d.transaction_id')
|
||||
->group('a.id')
|
||||
->order('a.id desc')
|
||||
->paginate($page)
|
||||
->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-08-25 23:34
|
||||
* @功能说明:佣金到账
|
||||
*/
|
||||
public function successCash($order_id){
|
||||
|
||||
$data = $this->dataInfo(['order_id'=>$order_id]);
|
||||
|
||||
if(!empty($data)&&$data['status']==1){
|
||||
|
||||
$res = $this->dataUpdate(['id'=>$data['id']],['status'=>2]);
|
||||
|
||||
if($res==0){
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
$user_model = new User();
|
||||
|
||||
$user = $user_model->dataInfo(['id'=>$data['top_id']]);
|
||||
|
||||
$res = $user_model->where(['id'=>$data['top_id'],'balance'=>$user['balance']])->update(['balance'=>$user['balance']+$data['cash'],'cash'=>$user['cash']+$data['cash']]);
|
||||
|
||||
if($res==0){
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$data['create_time'] = time();
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$data['update_time'] = time();
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page=10){
|
||||
|
||||
$data = $this->where($dis)->order('top desc,id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-08-26 23:39
|
||||
* @功能说明:添加佣金
|
||||
*/
|
||||
public function commissionAdd($order){
|
||||
|
||||
$user_model = new User();
|
||||
//上级
|
||||
$top = $user_model->where(['id'=>$order['user_id']])->value('pid');
|
||||
|
||||
if(!empty($top)){
|
||||
|
||||
$ser_model = new Service();
|
||||
|
||||
$com_mdoel = new Commission();
|
||||
|
||||
$com_goods_mdoel = new CommissionGoods();
|
||||
|
||||
foreach ($order['order_goods'] as $v){
|
||||
//查看是否有分销
|
||||
$ser = $ser_model->dataInfo(['id'=>$v['goods_id']]);
|
||||
|
||||
if(!empty($ser['com_balance'])){
|
||||
|
||||
$insert = [
|
||||
|
||||
'uniacid' => $order['uniacid'],
|
||||
|
||||
'user_id' => $order['user_id'],
|
||||
|
||||
'top_id' => $top,
|
||||
|
||||
'order_id'=> $order['id'],
|
||||
|
||||
'order_code' => $order['order_code'],
|
||||
|
||||
];
|
||||
|
||||
$find = $com_mdoel->dataInfo($insert);
|
||||
|
||||
$cash = $v['true_price']*$ser['com_balance']/100*$v['num'];
|
||||
|
||||
if(empty($find)){
|
||||
|
||||
$insert['cash'] = $cash;
|
||||
|
||||
$com_mdoel->dataAdd($insert);
|
||||
|
||||
$id = $com_mdoel->getLastInsID();
|
||||
|
||||
}else{
|
||||
|
||||
$id = $find['id'];
|
||||
|
||||
$update = [
|
||||
|
||||
'cash' => $find['cash']+$cash
|
||||
];
|
||||
//加佣金
|
||||
$com_mdoel->dataUpdate(['id'=>$find['id']],$update);
|
||||
|
||||
}
|
||||
|
||||
$insert = [
|
||||
|
||||
'uniacid' => $order['uniacid'],
|
||||
|
||||
'order_goods_id' => $v['id'],
|
||||
|
||||
'commission_id' => $id,
|
||||
|
||||
'cash' => $cash,
|
||||
|
||||
'num' => $v['num'],
|
||||
|
||||
'balance' => $ser['com_balance']
|
||||
];
|
||||
//添加到自订单记录表
|
||||
$res = $com_goods_mdoel->dataAdd($insert);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-08-28 14:35
|
||||
* @功能说明:佣金到账
|
||||
*/
|
||||
public function successCommission($order_id){
|
||||
|
||||
$comm = $this->dataInfo(['order_id'=>$order_id,'status'=>1]);
|
||||
|
||||
if(!empty($comm)){
|
||||
|
||||
$user_model = new User();
|
||||
|
||||
$user = $user_model->dataInfo(['id'=>$comm['top_id']]);
|
||||
|
||||
if(!empty($user)){
|
||||
|
||||
$update = [
|
||||
|
||||
'balance' => $user['balance']+$comm['cash'],
|
||||
|
||||
'cash' => $user['cash']+$comm['cash'],
|
||||
];
|
||||
|
||||
$user_model->dataUpdate(['id'=>$comm['top_id']],$update);
|
||||
|
||||
$this->dataUpdate(['id'=>$comm['id']],['status'=>2,'cash_time'=>time()]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-08-28 14:48
|
||||
* @功能说明:退款的时候要减去分销
|
||||
*/
|
||||
public function refundComm($refund_id){
|
||||
|
||||
$refund_model = new RefundOrder();
|
||||
|
||||
$com_goods_mdoel = new CommissionGoods();
|
||||
|
||||
$refund_order = $refund_model->dataInfo(['id'=>$refund_id]);
|
||||
|
||||
if(!empty($refund_order)){
|
||||
//查询这笔等待有无佣金
|
||||
$comm = $this->dataInfo(['order_id'=>$refund_order['order_id'],'status'=>1]);
|
||||
|
||||
if(!empty($comm)){
|
||||
|
||||
foreach ($refund_order['order_goods'] as $v){
|
||||
|
||||
$comm_goods = $com_goods_mdoel->dataInfo(['commission_id'=>$comm['id'],'order_goods_id'=>$v['order_goods_id']]);
|
||||
|
||||
$comm_goods_cash = $comm_goods['cash']/$comm_goods['num'];
|
||||
|
||||
$true_num = $comm_goods['num'] - $v['num'];
|
||||
|
||||
$true_num = $true_num>0?$true_num:0;
|
||||
|
||||
$update = [
|
||||
|
||||
'num' => $true_num,
|
||||
|
||||
'cash'=> $comm_goods_cash*$true_num
|
||||
];
|
||||
|
||||
$com_goods_mdoel->dataUpdate(['id'=>$comm_goods['id']],$update);
|
||||
|
||||
|
||||
}
|
||||
|
||||
$total_cash = $com_goods_mdoel->where(['commission_id'=>$comm['id']])->sum('cash');
|
||||
|
||||
$update = [
|
||||
|
||||
'cash' => $total_cash,
|
||||
|
||||
'status' => $total_cash>0?1:-1
|
||||
];
|
||||
|
||||
$this->dataUpdate(['id'=>$comm['id']],$update);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
99
app/massage/model/CommissionGoods.php
Normal file
99
app/massage/model/CommissionGoods.php
Normal file
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class CommissionGoods extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'massage_service_order_commission_goods';
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-08-25 23:19
|
||||
* @功能说明:
|
||||
*/
|
||||
public function goodsList($dis){
|
||||
|
||||
$data = $this->alias('a')
|
||||
->join('massage_service_order_goods_list b','a.order_goods_id = b.id')
|
||||
->where($dis)
|
||||
->field('a.*,b.goods_name,b.goods_cover,b.true_price')
|
||||
->group('a.id')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page=10){
|
||||
|
||||
$data = $this->where($dis)->order('top desc,id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
84
app/massage/model/Config.php
Normal file
84
app/massage/model/Config.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class Config extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
// protected $name = 'lbfarm_config';
|
||||
protected $name = 'lbfarm_config';
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page){
|
||||
|
||||
$data = $this->where($dis)->order('id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
if(empty($data)){
|
||||
|
||||
$this->dataAdd($dis);
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
}
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
628
app/massage/model/Coupon.php
Normal file
628
app/massage/model/Coupon.php
Normal file
@@ -0,0 +1,628 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use app\member\model\Level;
|
||||
use think\facade\Db;
|
||||
|
||||
class Coupon extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'massage_service_coupon';
|
||||
|
||||
|
||||
protected $append = [
|
||||
|
||||
'service',
|
||||
|
||||
'send_count',
|
||||
|
||||
'member_level',
|
||||
|
||||
'shop_goods',
|
||||
|
||||
'restaurant_goods'
|
||||
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-15 15:22
|
||||
* @功能说明:已派发多少张
|
||||
*/
|
||||
public function getSendCountAttr($value,$data){
|
||||
|
||||
if(!empty($data['id'])){
|
||||
|
||||
$record_model = new CouponRecord();
|
||||
|
||||
$count = $record_model->where(['coupon_id'=>$data['id']])->sum('num');
|
||||
|
||||
return $count;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-11 01:54
|
||||
* @功能说明:
|
||||
*/
|
||||
public function getServiceAttr($value,$data){
|
||||
|
||||
if(!empty($data['id'])){
|
||||
|
||||
$ser_model = new Goods();
|
||||
|
||||
$dis = [
|
||||
|
||||
'a.status' => 1,
|
||||
|
||||
'b.coupon_id' => $data['id'],
|
||||
|
||||
'b.type' => 0,
|
||||
|
||||
'b.scene' => 1
|
||||
];
|
||||
|
||||
$list = $ser_model->alias('a')
|
||||
->join('massage_service_coupon_goods b','b.goods_id = a.id')
|
||||
->where($dis)
|
||||
->field('a.id,a.title,a.price,b.goods_id,a.cover')
|
||||
->group('a.id')
|
||||
->order('a.top desc,a.id desc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return $list;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-11 01:54
|
||||
* @功能说明:
|
||||
*/
|
||||
public function getShopGoodsAttr($value,$data){
|
||||
|
||||
if(!empty($data['id'])){
|
||||
|
||||
$ser_model = new \app\shop\model\Goods();
|
||||
|
||||
$dis = [
|
||||
'a.status' => 1,
|
||||
|
||||
'b.coupon_id' => $data['id'],
|
||||
|
||||
'b.type' => 0,
|
||||
|
||||
'b.scene' => 2
|
||||
|
||||
];
|
||||
|
||||
$list = $ser_model->alias('a')
|
||||
->join('massage_service_coupon_goods b','b.goods_id = a.id')
|
||||
->where($dis)
|
||||
->field('a.id,a.name,b.goods_id,a.cover')
|
||||
->group('a.id')
|
||||
->order('a.top desc,a.id desc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return $list;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-11 01:54
|
||||
* @功能说明:
|
||||
*/
|
||||
public function getRestaurantGoodsAttr($value,$data){
|
||||
|
||||
if(!empty($data['id'])){
|
||||
|
||||
$ser_model = new \app\restaurant\model\Goods();
|
||||
|
||||
$dis = [
|
||||
'a.status' => 1,
|
||||
|
||||
'b.coupon_id' => $data['id'],
|
||||
|
||||
'b.type' => 0,
|
||||
|
||||
'b.scene' => 3
|
||||
|
||||
];
|
||||
|
||||
$list = $ser_model->alias('a')
|
||||
->join('massage_service_coupon_goods b','b.goods_id = a.id')
|
||||
->where($dis)
|
||||
->field('a.id,a.title,b.goods_id,a.cover')
|
||||
->group('a.id')
|
||||
->order('a.id desc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return $list;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-11 01:54
|
||||
* @功能说明:
|
||||
*/
|
||||
public function getMemberLevelAttr($value,$data){
|
||||
|
||||
if(!empty($data['id'])){
|
||||
|
||||
$level_model = new Level();
|
||||
|
||||
$dis = [
|
||||
|
||||
'a.status' => 1,
|
||||
|
||||
'b.coupon_id' => $data['id'],
|
||||
];
|
||||
|
||||
$list = $level_model->alias('a')
|
||||
->join('longbing_card_v2_coupon_connect b','b.member_level = a.id')
|
||||
->where($dis)
|
||||
->field('a.id,a.title')
|
||||
->group('a.id')
|
||||
->order('a.id desc')
|
||||
->column('a.id');
|
||||
|
||||
return array_values($list);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$data['create_time'] = time();
|
||||
|
||||
$data_data = $data;
|
||||
|
||||
if(isset($data['service'])){
|
||||
|
||||
unset($data['service']);
|
||||
}
|
||||
|
||||
if(isset($data['member_level'])){
|
||||
|
||||
unset($data['member_level']);
|
||||
}
|
||||
|
||||
if(isset($data['shop_goods'])){
|
||||
|
||||
unset($data['shop_goods']);
|
||||
}
|
||||
|
||||
if(isset($data['restaurant_goods'])){
|
||||
|
||||
unset($data['restaurant_goods']);
|
||||
}
|
||||
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
$id = $this->getLastInsID();
|
||||
|
||||
$this->updateSome($id,$data_data);
|
||||
|
||||
return $id;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$data_data = $data;
|
||||
|
||||
if(isset($data['service'])){
|
||||
|
||||
unset($data['service']);
|
||||
}
|
||||
|
||||
if(isset($data['member_level'])){
|
||||
|
||||
unset($data['member_level']);
|
||||
}
|
||||
|
||||
if(isset($data['shop_goods'])){
|
||||
|
||||
unset($data['shop_goods']);
|
||||
}
|
||||
|
||||
if(isset($data['restaurant_goods'])){
|
||||
|
||||
unset($data['restaurant_goods']);
|
||||
}
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
$this->updateSome($dis['id'],$data_data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @param $data
|
||||
* @功能说明:
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-11-01 15:40
|
||||
*/
|
||||
public function updateSome($id,$data){
|
||||
|
||||
$server = new \app\shop\server\Coupon();
|
||||
|
||||
$s_model = new CouponService();
|
||||
|
||||
$coupon_member_model = new CouponMember();
|
||||
|
||||
$goods_model = new \app\shop\model\Goods();
|
||||
|
||||
$r_goods_model = new \app\restaurant\model\Goods();
|
||||
|
||||
$coupon_member_model->where(['coupon_id'=>$id])->delete();
|
||||
|
||||
$s_model->where(['coupon_id'=>$id])->delete();
|
||||
//赛车服务
|
||||
$server->addObserver($s_model);
|
||||
//会员
|
||||
$server->addObserver($coupon_member_model);
|
||||
//商城商品
|
||||
$server->addObserver($goods_model);
|
||||
//
|
||||
$server->addObserver($r_goods_model);
|
||||
|
||||
$res = $server->notify($id,$data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @param $uniacid
|
||||
* @param $spe
|
||||
* @功能说明:
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-23 13:35
|
||||
*/
|
||||
public function updateSomev2($id,$uniacid,$goods,$member_level,$shop_goods){
|
||||
|
||||
$s_model = new CouponService();
|
||||
|
||||
$coupon_member_model = new CouponMember();
|
||||
|
||||
$s_model->where(['coupon_id'=>$id])->delete();
|
||||
|
||||
if(!empty($goods)){
|
||||
|
||||
foreach ($goods as $value){
|
||||
|
||||
$insert['uniacid'] = $uniacid;
|
||||
|
||||
$insert['coupon_id'] = $id;
|
||||
|
||||
$insert['goods_id'] = $value;
|
||||
|
||||
$s_model->dataAdd($insert);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!empty($shop_goods)){
|
||||
|
||||
foreach ($shop_goods as $value){
|
||||
|
||||
$insert['uniacid'] = $uniacid;
|
||||
|
||||
$insert['coupon_id'] = $id;
|
||||
|
||||
$insert['goods_id'] = $value;
|
||||
|
||||
$insert['scene'] = 2;
|
||||
|
||||
$s_model->dataAdd($insert);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$coupon_member_model->where(['coupon_id'=>$id])->delete();
|
||||
|
||||
if(!empty($member_level)){
|
||||
|
||||
foreach ($member_level as &$value){
|
||||
|
||||
$inserts['uniacid'] = $uniacid;
|
||||
|
||||
$inserts['coupon_id'] = $id;
|
||||
|
||||
$inserts['member_level'] = $value;
|
||||
|
||||
$coupon_member_model->dataAdd($inserts);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page){
|
||||
|
||||
$data = $this->where($dis)->order('top desc,id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis,$filed='*'){
|
||||
|
||||
$data = $this->where($dis)->field($filed)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-09 23:22
|
||||
* @功能说明:计算优惠券可以优惠多少钱
|
||||
*/
|
||||
|
||||
public function getDicountPrice($order_goods,$coupon_id,$scene=1){
|
||||
|
||||
// $coupon_se_model = new CouponService();
|
||||
//暂时没有商品限制 先注释
|
||||
// $goods_id = $coupon_se_model->where(['coupon_id'=>$coupon_id,'type'=>1,'scene'=>$scene])->column('goods_id');
|
||||
|
||||
$price = 0;
|
||||
|
||||
foreach ($order_goods as $v){
|
||||
|
||||
foreach ($v as $vs){
|
||||
|
||||
// if(in_array($vs['goods_list'],$goods_id)){
|
||||
|
||||
$price += $v['true_price'];
|
||||
//暂时没有商品限制
|
||||
$goods_id[] = $vs['goods_id'];
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$data['discount'] = $price;
|
||||
|
||||
$data['goods_id'] = $goods_id;
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-09 23:37
|
||||
* @功能说明:订单优惠券
|
||||
*/
|
||||
public function orderCouponData($order_goods,$coupon_id,$scene=1){
|
||||
|
||||
if(empty($coupon_id)){
|
||||
|
||||
return $order_goods;
|
||||
}
|
||||
|
||||
$coupon_record_model = new CouponRecord();
|
||||
|
||||
$info = $coupon_record_model->dataInfo(['id'=>$coupon_id]);
|
||||
//是否被使用或者过期
|
||||
if(empty($info)||$info['status']!=1){
|
||||
|
||||
return $order_goods;
|
||||
}
|
||||
|
||||
if($info['start_time']<time()&&$info['end_time']>time()){
|
||||
|
||||
$p_coupon_id = !empty($info['pid'])?$info['pid']:$coupon_id;
|
||||
|
||||
$can_discount_price = $this->getDicountPrice($order_goods['list'],$p_coupon_id,$scene);
|
||||
//是否满足满减条件
|
||||
if($info['full']>$can_discount_price['discount']||$can_discount_price['discount']==0){
|
||||
|
||||
return $order_goods;
|
||||
}
|
||||
|
||||
$total_discount = 0;
|
||||
|
||||
foreach ($order_goods['list'] as $vs){
|
||||
|
||||
foreach ($vs as &$v){
|
||||
//如果该商品可以使用优惠券
|
||||
if(in_array($v['goods_id'],$can_discount_price['goods_id'])){
|
||||
|
||||
$bin = $v['true_price']/$can_discount_price['discount'];
|
||||
//该商品减去的折扣
|
||||
$discount = $bin*$info['discount']<$v['true_price']?$bin*$info['discount']:$v['true_price'];
|
||||
//总计折扣
|
||||
$total_discount+=$discount;
|
||||
|
||||
$v['true_price'] = round($v['true_price']-$discount,2);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$total_discount = $info['full']>$info['discount']?$info['discount']:round($total_discount,2);
|
||||
|
||||
$order_goods['total_discount'] = round($total_discount,2);
|
||||
|
||||
$order_goods['coupon_id'] = $coupon_id;
|
||||
|
||||
}
|
||||
|
||||
return $order_goods;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-13 11:58
|
||||
* @功能说明:用户可用的优惠券
|
||||
*/
|
||||
public function canUseCoupon($user_id,$type=1,$is_show=1,$no_i=1,$table_id=0){
|
||||
|
||||
$coupon_model = new CouponRecord();
|
||||
|
||||
$coupon_model->where(['user_id'=>$user_id,'status'=>1])->where('end_time','<',time())->update(['status'=>3]);
|
||||
|
||||
$list = $coupon_model->where(['user_id'=>$user_id,'status'=>1])->order('id desc')->select()->toArray();
|
||||
|
||||
if($type==1){
|
||||
|
||||
$car_model = new Car();
|
||||
//获取购物车里面的信息
|
||||
$car_list = $car_model->carPriceAndCount($user_id,1);
|
||||
|
||||
}else{
|
||||
|
||||
if($type==2){
|
||||
|
||||
$car_model = new \app\shop\model\Car();
|
||||
//获取购物车里面的信息
|
||||
$car_list = $car_model->carPriceAndCount($user_id,1,1,$is_show,$no_i);
|
||||
}else{
|
||||
|
||||
$car_model = new \app\restaurant\model\Car();
|
||||
|
||||
$car_list = $car_model->carPriceAndCount($user_id,2,$table_id);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$car_list = $car_list['list'];
|
||||
|
||||
$data = [];
|
||||
|
||||
if(!empty($list)){
|
||||
|
||||
foreach ($list as &$v){
|
||||
|
||||
if($v['start_time']<time()&&$v['end_time']>time()){
|
||||
|
||||
$id = !empty($v['pid'])?$v['pid']:$v['id'];
|
||||
|
||||
$info = $this->getDicountPrice($car_list,$id,$type);
|
||||
|
||||
if($v['full']<=$info['discount']&&$info['discount']>0){
|
||||
|
||||
$data[] = $v['id'];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-10-28 10:50
|
||||
* @功能说明:商城用户可以领取的优惠券
|
||||
*/
|
||||
public function shopCanGetCoupon($uniacid,$user_id,$page=10){
|
||||
|
||||
$record_model = new CouponRecord();
|
||||
|
||||
$id = $record_model->where(['user_id'=>$user_id])->column('coupon_id');
|
||||
|
||||
$dis = [
|
||||
|
||||
'uniacid' => $uniacid,
|
||||
|
||||
'status' => 1,
|
||||
|
||||
'send_type'=> 2
|
||||
|
||||
];
|
||||
|
||||
$where[] = ['time_limit','=',1];
|
||||
|
||||
$where[] = ['end_time','>',time()];
|
||||
|
||||
|
||||
$data = $this->where($dis)->where('id','not in',$id)->where(function ($query) use ($where){
|
||||
$query->whereOr($where);
|
||||
})->order('top desc,id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
356
app/massage/model/CouponAtv.php
Normal file
356
app/massage/model/CouponAtv.php
Normal file
@@ -0,0 +1,356 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class CouponAtv extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'massage_service_coupon_atv';
|
||||
|
||||
|
||||
|
||||
protected $append = [
|
||||
|
||||
'coupon'
|
||||
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-23 13:46
|
||||
* @功能说明:分类下面端商品数量
|
||||
*/
|
||||
public function getCouponAttr($value,$data){
|
||||
|
||||
if(!empty($data['id'])){
|
||||
|
||||
$coupom_model = new Coupon();
|
||||
|
||||
$dis = [
|
||||
|
||||
'a.status' => 1,
|
||||
|
||||
'b.atv_id' => $data['id']
|
||||
];
|
||||
|
||||
$list = $coupom_model->alias('a')
|
||||
->join('massage_service_coupon_atv_coupon b','b.coupon_id = a.id')
|
||||
->where($dis)
|
||||
->field('a.*,b.num,b.coupon_id')
|
||||
->group('b.coupon_id')
|
||||
->order('a.top desc,id desc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
|
||||
$service = $data['coupon'];
|
||||
|
||||
unset($data['coupon']);
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
$id = $this->getLastInsID();
|
||||
|
||||
$this->updateSome($id,$data['uniacid'],$service);
|
||||
|
||||
return $id;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
|
||||
// $data['update_time'] = time();
|
||||
|
||||
if(isset($data['coupon'])){
|
||||
|
||||
$service = $data['coupon'];
|
||||
|
||||
unset($data['coupon']);
|
||||
}
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
if(!empty($service)){
|
||||
|
||||
$id = $this->where($dis)->value('id');
|
||||
|
||||
$this->updateSome($id,$data['uniacid'],$service);
|
||||
}
|
||||
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @param $uniacid
|
||||
* @param $spe
|
||||
* @功能说明:
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-23 13:35
|
||||
*/
|
||||
public function updateSome($id,$uniacid,$coupon){
|
||||
|
||||
$s_model = new CouponAtvCoupon();
|
||||
|
||||
$s_model->where(['atv_id'=>$id])->delete();
|
||||
|
||||
if(!empty($coupon)){
|
||||
|
||||
foreach ($coupon as $value){
|
||||
|
||||
$insert['uniacid'] = $uniacid;
|
||||
|
||||
$insert['atv_id'] = $id;
|
||||
|
||||
$insert['coupon_id'] = $value['id'];
|
||||
|
||||
$insert['num'] = $value['num'];
|
||||
|
||||
$s_model->dataAdd($insert);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page){
|
||||
|
||||
$data = $this->where($dis)->order('top desc,id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
if(empty($data)){
|
||||
|
||||
$this->insert($dis);
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
}
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-12 17:52
|
||||
* @功能说明:优惠券活动邀请新用户
|
||||
*/
|
||||
public function invUser($user_id,$record_id){
|
||||
|
||||
$atv_record_model = new CouponAtvRecord();
|
||||
|
||||
$atv_record_list_model = new CouponAtvRecordList();
|
||||
|
||||
$record = $atv_record_model->dataInfo(['id'=>$record_id]);
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
if(!empty($record)&&$record['end_time']>time()&&$record['status']==1){
|
||||
|
||||
$insert = [
|
||||
|
||||
'uniacid' => $record['uniacid'],
|
||||
|
||||
'user_id' => $record['user_id'],
|
||||
|
||||
'to_inv_id'=> $user_id,
|
||||
|
||||
'record_id'=> $record_id
|
||||
|
||||
];
|
||||
//添加邀请者记录
|
||||
$res = $atv_record_list_model->dataAdd($insert);
|
||||
|
||||
if(!empty($res['code'])){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
return ['code'=>500,'msg'=>'登陆失败,请刷新重试'];
|
||||
}
|
||||
//新用户获得卡券
|
||||
if($record['to_inv_user']==1&&!empty($record['coupon'])){
|
||||
|
||||
$res = $this->giveAtvCoupon($record_id,$user_id);
|
||||
|
||||
if(!empty($res['code'])){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
}
|
||||
//检查任务是否完成
|
||||
$res = $this->recordSuccess($record_id);
|
||||
|
||||
if(!empty($res['code'])){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-13 00:07
|
||||
* @功能说明:给用户获得卡券
|
||||
*/
|
||||
public function giveAtvCoupon($record_id,$user_id){
|
||||
|
||||
$atv_record_model = new CouponAtvRecord();
|
||||
|
||||
$record_model = new CouponRecord();
|
||||
|
||||
$atv_record_coupon_model = new CouponAtvRecordCoupon();
|
||||
|
||||
$record = $atv_record_model->dataInfo(['id'=>$record_id]);
|
||||
|
||||
foreach ($record['coupon'] as $value){
|
||||
//派发卡券
|
||||
// $num = $value['stock']>=$value['num']?$value['num']:$value['stock'];
|
||||
|
||||
$num = $value['num'];
|
||||
|
||||
if($num>0){
|
||||
|
||||
$res = $record_model->recordAdd($value['coupon_id'],$user_id,$num);
|
||||
|
||||
if($res==0){
|
||||
|
||||
return ['code'=>500,'msg'=>'登陆失败,请刷新重试'];
|
||||
}
|
||||
//添加派发记录
|
||||
$insert = [
|
||||
|
||||
'uniacid' => $record['uniacid'],
|
||||
|
||||
'user_id' => $user_id,
|
||||
|
||||
'atv_id' => $record['atv_id'],
|
||||
|
||||
'coupon_id' => $value['coupon_id'],
|
||||
|
||||
'num' => $value['num'],
|
||||
|
||||
'status' => 2,
|
||||
|
||||
'success_num' => $num
|
||||
|
||||
];
|
||||
|
||||
$res = $atv_record_coupon_model->dataAdd($insert);
|
||||
|
||||
if($res==0){
|
||||
|
||||
return ['code'=>500,'msg'=>'登陆失败,请刷新重试'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-12 23:46
|
||||
* @功能说明:获得成功
|
||||
*/
|
||||
public function recordSuccess($record_id){
|
||||
|
||||
$atv_record_list_model = new CouponAtvRecordList();
|
||||
|
||||
$atv_record_model = new CouponAtvRecord();
|
||||
//已经邀请多少人了
|
||||
$have_num = $atv_record_list_model->where(['record_id'=>$record_id])->count();
|
||||
|
||||
$record = $atv_record_model->dataInfo(['id'=>$record_id]);
|
||||
//如果成功
|
||||
if($have_num>=$record['inv_user_num']){
|
||||
//修改获得状态
|
||||
$res = $atv_record_model->dataUpdate(['id'=>$record['id'],'status'=>1],['status'=>2]);
|
||||
|
||||
if($res==0){
|
||||
|
||||
return ['code'=>500,'msg'=>'登陆失败,请刷新重试'];
|
||||
}
|
||||
|
||||
if($record['inv_user']==1){
|
||||
//给发起者派送卡券
|
||||
$res = $this->giveAtvCoupon($record_id,$record['user_id']);
|
||||
|
||||
if(!empty($res['code'])){
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
216
app/massage/model/CouponAtvCoupon.php
Normal file
216
app/massage/model/CouponAtvCoupon.php
Normal file
@@ -0,0 +1,216 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class CouponAtvCoupon extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'massage_service_coupon_atv_coupon';
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
// $data['create_time'] = time();
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-04-08 17:08
|
||||
* @功能说明:审核中
|
||||
*/
|
||||
public function shIng($cap_id){
|
||||
|
||||
$dis = [
|
||||
|
||||
'cap_id' => $cap_id,
|
||||
|
||||
'status' => 1
|
||||
];
|
||||
|
||||
$count = $this->where($dis)->count();
|
||||
|
||||
return $count;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page=10){
|
||||
|
||||
$data = $this->where($dis)->order('id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-17 15:23
|
||||
* @功能说明:通过
|
||||
*/
|
||||
public function subSh($id,$goods_id){
|
||||
|
||||
$goods_list_model = new GoodsShList();
|
||||
|
||||
$goods_model = new Goods();
|
||||
|
||||
$list = $goods_model->where('id','in',$goods_id)->select()->toArray();
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
foreach ($list as $value){
|
||||
|
||||
$insert = [
|
||||
|
||||
'uniacid' => $value['uniacid'],
|
||||
|
||||
'sh_id' => $id,
|
||||
|
||||
'goods_id' => $value['id'],
|
||||
|
||||
'goods_name' => $value['goods_name'],
|
||||
|
||||
'cover' => $value['cover'],
|
||||
|
||||
'imgs' => !empty($value['imgs'])?implode(',',$value['imgs']):'',
|
||||
|
||||
'text' => $value['text'],
|
||||
|
||||
'cate_id' => $value['cate_id'],
|
||||
|
||||
];
|
||||
//添加到审核商品表
|
||||
$res = $goods_list_model->dataAdd($insert);
|
||||
|
||||
if($res!=1){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
return ['code'=>500,'msg'=>'提交失败'];
|
||||
}
|
||||
|
||||
$goods_sh_id = $goods_list_model->getLastInsID();
|
||||
|
||||
if(!empty($value['spe'])){
|
||||
|
||||
foreach ($value['spe'] as $v){
|
||||
|
||||
$insert = [
|
||||
|
||||
'uniacid' => $v['uniacid'],
|
||||
|
||||
'sh_goods_id' => $goods_sh_id,
|
||||
|
||||
'title' => $v['title'],
|
||||
|
||||
'stock' => $v['stock'],
|
||||
|
||||
'price' => $v['price'],
|
||||
|
||||
'spe_id' => $v['id'],
|
||||
|
||||
];
|
||||
//添加审核规格表
|
||||
$res = Db::name('shequshop_school_goods_sh_spe')->insert($insert);
|
||||
|
||||
if($res!=1){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
return ['code'=>500,'msg'=>'提交失败'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//将商品状态改为审核中
|
||||
$goods_model->where('id','in',$goods_id)->update(['status'=>4]);
|
||||
|
||||
Db::commit();
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-06 00:02
|
||||
* @功能说明:用户订单数
|
||||
*/
|
||||
public function couponCount($user_id){
|
||||
|
||||
$dis[] = ['user_id','=',$user_id];
|
||||
|
||||
$dis[] = ['status','=',1];
|
||||
|
||||
$dis[] = ['end_time','>',time()];
|
||||
|
||||
$data = $this->where($dis)->count();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
199
app/massage/model/CouponAtvRecord.php
Normal file
199
app/massage/model/CouponAtvRecord.php
Normal file
@@ -0,0 +1,199 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class CouponAtvRecord extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'massage_service_coupon_atv_record';
|
||||
|
||||
|
||||
|
||||
|
||||
protected $append = [
|
||||
|
||||
'coupon'
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-12 23:06
|
||||
* @功能说明:派发的优惠券
|
||||
*/
|
||||
public function getCouponAttr($value,$data){
|
||||
|
||||
if(!empty($data['id'])){
|
||||
|
||||
$list_model = new CouponAtvRecordCoupon();
|
||||
|
||||
$dis = [
|
||||
|
||||
'a.record_id' => $data['id'],
|
||||
|
||||
'a.user_id' => 0,
|
||||
|
||||
// 'b.status' => 1
|
||||
];
|
||||
|
||||
$list = $list_model->alias('a')
|
||||
->join('massage_service_coupon b','a.coupon_id = b.id')
|
||||
->where($dis)
|
||||
->where('b.status','>',-1)
|
||||
->field('a.*,b.title,b.stock,b.i')
|
||||
->group('a.coupon_id')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return $list;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-19 10:47
|
||||
* @功能说明:判断卡券是否参加活动
|
||||
*/
|
||||
public function couponIsAtv($coupon_id){
|
||||
|
||||
$dis_where[] = ['status','=',1];
|
||||
|
||||
$dis_where[] = ['end_time','<',time()];
|
||||
//修改过期状态
|
||||
$this->dataUpdate($dis_where,['status'=>3]);
|
||||
|
||||
$dis = [
|
||||
//活动进行中
|
||||
'a.status' => 1,
|
||||
|
||||
'b.coupon_id' => $coupon_id
|
||||
];
|
||||
|
||||
$data = $this->alias('a')
|
||||
->join('massage_service_coupon_atv_record_coupon b','a.id = b.record_id')
|
||||
->where($dis)
|
||||
->count();
|
||||
|
||||
return !empty($data)?true:false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-04-08 17:08
|
||||
* @功能说明:审核中
|
||||
*/
|
||||
public function shIng($cap_id){
|
||||
|
||||
$dis = [
|
||||
|
||||
'cap_id' => $cap_id,
|
||||
|
||||
'status' => 1
|
||||
];
|
||||
|
||||
$count = $this->where($dis)->count();
|
||||
|
||||
return $count;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page=10){
|
||||
|
||||
$data = $this->where($dis)->order('id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-06 00:02
|
||||
* @功能说明:用户订单数
|
||||
*/
|
||||
public function couponCount($user_id){
|
||||
|
||||
$dis[] = ['user_id','=',$user_id];
|
||||
|
||||
$dis[] = ['status','=',1];
|
||||
|
||||
$dis[] = ['end_time','>',time()];
|
||||
|
||||
$data = $this->where($dis)->count();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
127
app/massage/model/CouponAtvRecordCoupon.php
Normal file
127
app/massage/model/CouponAtvRecordCoupon.php
Normal file
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class CouponAtvRecordCoupon extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'massage_service_coupon_atv_record_coupon';
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
// $data['create_time'] = time();
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-04-08 17:08
|
||||
* @功能说明:审核中
|
||||
*/
|
||||
public function shIng($cap_id){
|
||||
|
||||
$dis = [
|
||||
|
||||
'cap_id' => $cap_id,
|
||||
|
||||
'status' => 1
|
||||
];
|
||||
|
||||
$count = $this->where($dis)->count();
|
||||
|
||||
return $count;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page=10){
|
||||
|
||||
$data = $this->where($dis)->order('id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-06 00:02
|
||||
* @功能说明:用户订单数
|
||||
*/
|
||||
public function couponCount($user_id){
|
||||
|
||||
$dis[] = ['user_id','=',$user_id];
|
||||
|
||||
$dis[] = ['status','=',1];
|
||||
|
||||
$dis[] = ['end_time','>',time()];
|
||||
|
||||
$data = $this->where($dis)->count();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
120
app/massage/model/CouponAtvRecordList.php
Normal file
120
app/massage/model/CouponAtvRecordList.php
Normal file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class CouponAtvRecordList extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'massage_service_coupon_atv_record_list';
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$data['create_time'] = time();
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-04-08 17:08
|
||||
* @功能说明:审核中
|
||||
*/
|
||||
public function shIng($cap_id){
|
||||
|
||||
$dis = [
|
||||
|
||||
'cap_id' => $cap_id,
|
||||
|
||||
'status' => 1
|
||||
];
|
||||
|
||||
$count = $this->where($dis)->count();
|
||||
|
||||
return $count;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page=10){
|
||||
|
||||
$data = $this->alias('a')
|
||||
->join('massage_service_user_list b','b.id = a.to_inv_id')
|
||||
->where($dis)
|
||||
->field('b.nickName,b.avatarUrl,b.id,a.create_time')
|
||||
->group('b.id')
|
||||
->paginate($page)
|
||||
->toArray();
|
||||
|
||||
if(!empty($data['data'])){
|
||||
|
||||
foreach ($data['data'] as &$v){
|
||||
|
||||
$v['create_time'] = date('Y-m-d H:i:s',$v['create_time']);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
101
app/massage/model/CouponMember.php
Normal file
101
app/massage/model/CouponMember.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class CouponMember extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_card_v2_coupon_connect';
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page){
|
||||
|
||||
$data = $this->where($dis)->order('top desc,id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-11-01 15:43
|
||||
* @功能说明:优惠券
|
||||
*/
|
||||
public function eventCoupon($id,$data){
|
||||
|
||||
if(!empty($data['member_level'])){
|
||||
|
||||
foreach ($data['member_level'] as $value){
|
||||
|
||||
$insert['uniacid'] = $data['uniacid'];
|
||||
|
||||
$insert['coupon_id'] = $id;
|
||||
|
||||
$insert['member_level'] = $value;
|
||||
|
||||
$this->dataAdd($insert);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
534
app/massage/model/CouponRecord.php
Normal file
534
app/massage/model/CouponRecord.php
Normal file
@@ -0,0 +1,534 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use app\member\model\Level;
|
||||
use think\facade\Db;
|
||||
|
||||
class CouponRecord extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'massage_service_coupon_record';
|
||||
|
||||
|
||||
protected $append = [
|
||||
|
||||
'goods',
|
||||
|
||||
'shop_goods',
|
||||
|
||||
'restaurant_goods'
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-11 01:54
|
||||
* @功能说明:
|
||||
*/
|
||||
public function getGoodsAttr($value,$data){
|
||||
|
||||
if(!empty($data['id'])){
|
||||
|
||||
$id = !empty($data['pid'])?$data['pid']:$data['id'];
|
||||
|
||||
$ser_model = new Goods();
|
||||
|
||||
$dis = [
|
||||
|
||||
'a.status' => 1,
|
||||
|
||||
'b.coupon_id' => $id,
|
||||
|
||||
'b.type' => 1,
|
||||
|
||||
'b.scene' => 1,
|
||||
|
||||
|
||||
];
|
||||
|
||||
$list = $ser_model->alias('a')
|
||||
->join('massage_service_coupon_goods b','b.goods_id = a.id')
|
||||
->where($dis)
|
||||
->field('a.id,a.title,a.price,b.goods_id')
|
||||
->group('a.id')
|
||||
->order('a.top desc,a.id desc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return $list;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-11 01:54
|
||||
* @功能说明:
|
||||
*/
|
||||
public function getShopGoodsAttr($value,$data){
|
||||
|
||||
if(!empty($data['id'])){
|
||||
|
||||
$id = !empty($data['pid'])?$data['pid']:$data['id'];
|
||||
|
||||
$ser_model = new \app\shop\model\Goods();
|
||||
|
||||
$dis = [
|
||||
|
||||
'a.status' => 1,
|
||||
|
||||
'b.coupon_id' => $id,
|
||||
|
||||
'b.type' => 1,
|
||||
|
||||
'b.scene' => 2,
|
||||
|
||||
];
|
||||
|
||||
$list = $ser_model->alias('a')
|
||||
->join('massage_service_coupon_goods b','b.goods_id = a.id')
|
||||
->where($dis)
|
||||
->field('a.id,a.name,b.goods_id')
|
||||
->group('a.id')
|
||||
->order('a.top desc,a.id desc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return $list;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-11 01:54
|
||||
* @功能说明:
|
||||
*/
|
||||
public function getRestaurantGoodsAttr($value,$data){
|
||||
|
||||
if(!empty($data['id'])){
|
||||
|
||||
$id = !empty($data['pid'])?$data['pid']:$data['id'];
|
||||
|
||||
$ser_model = new \app\restaurant\model\Goods();
|
||||
|
||||
$dis = [
|
||||
|
||||
'a.status' => 1,
|
||||
|
||||
'b.coupon_id' => $id,
|
||||
|
||||
'b.type' => 1,
|
||||
|
||||
'b.scene' => 3,
|
||||
|
||||
];
|
||||
|
||||
$list = $ser_model->alias('a')
|
||||
->join('massage_service_coupon_goods b','b.goods_id = a.id')
|
||||
->where($dis)
|
||||
->field('a.id,a.title,b.goods_id')
|
||||
->group('a.id')
|
||||
->order('a.id desc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return $list;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-15 14:37
|
||||
* @功能说明:后台列表
|
||||
*/
|
||||
public function adminDataList($dis,$page=10,$where=[]){
|
||||
|
||||
$data = $this->alias('a')
|
||||
->join('shequshop_school_cap_list b','a.cap_id = b.id')
|
||||
->where($dis)
|
||||
->where(function ($query) use ($where){
|
||||
$query->whereOr($where);
|
||||
})
|
||||
->field('a.*,b.store_name,b.store_img,b.name,b.mobile')
|
||||
->group('a.id')
|
||||
->order('a.id desc')
|
||||
->paginate($page)
|
||||
->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-15 14:37
|
||||
* @功能说明:后台审核详情
|
||||
*/
|
||||
public function adminDataInfo($dis){
|
||||
|
||||
$data = $this->alias('a')
|
||||
->join('shequshop_school_cap_list b','a.cap_id = b.id')
|
||||
->where($dis)
|
||||
->field('a.*,b.store_name,b.store_img,b.school_name,b.mobile')
|
||||
->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$data['create_time'] = time();
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-04-08 17:08
|
||||
* @功能说明:审核中
|
||||
*/
|
||||
public function shIng($cap_id){
|
||||
|
||||
$dis = [
|
||||
|
||||
'cap_id' => $cap_id,
|
||||
|
||||
'status' => 1
|
||||
];
|
||||
|
||||
$count = $this->where($dis)->count();
|
||||
|
||||
return $count;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page=10){
|
||||
|
||||
$data = $this->where($dis)->order('id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-06 00:02
|
||||
* @功能说明:用户订单数
|
||||
*/
|
||||
public function couponCount($user_id){
|
||||
|
||||
$dis[] = ['user_id','=',$user_id];
|
||||
|
||||
$dis[] = ['status','=',1];
|
||||
|
||||
$dis[] = ['end_time','>',time()];
|
||||
|
||||
$data = $this->where($dis)->sum('num');
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-08 11:57
|
||||
* @功能说明:初始化
|
||||
*/
|
||||
public function initCoupon($uniacid){
|
||||
|
||||
$dis[] = ['status','=',1];
|
||||
|
||||
$dis[] = ['uniacid','=',$uniacid];
|
||||
|
||||
$dis[] = ['end_time','<',time()];
|
||||
|
||||
$res = $this->dataUpdate($dis,['status'=>3]);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-12 15:36
|
||||
* @功能说明:派发优惠券
|
||||
*/
|
||||
public function recordAdd($coupon_id,$user_id,$num=1,$user_get=0){
|
||||
|
||||
$coupon_model = new Coupon();
|
||||
|
||||
$coupon = $coupon_model->dataInfo(['id'=>$coupon_id]);
|
||||
//用户自己领取的优惠券
|
||||
if($user_get==1){
|
||||
|
||||
if($coupon['send_type']!=2){
|
||||
|
||||
return ['code'=>500,'msg'=>'优惠券已下架'];
|
||||
|
||||
}
|
||||
|
||||
$user_model = new User();
|
||||
|
||||
$user_info = $user_model->dataInfo(['id'=>$user_id]);
|
||||
|
||||
$level = $coupon['member_level'];
|
||||
|
||||
if(!in_array($user_info['member_level'],$level)){
|
||||
|
||||
$level_model = new Level();
|
||||
|
||||
$level_title = $level_model->where('id','in',$level)->column('title');
|
||||
|
||||
$level_title = !empty($level_title)?implode(',',$level_title):'';
|
||||
|
||||
return ['code'=>50002,'msg'=>'只有'.$level_title.'等级的会员才能领取'];
|
||||
|
||||
}
|
||||
|
||||
if($coupon['stock']<$num){
|
||||
|
||||
return ['code'=>500,'msg'=>'库存不足'];
|
||||
}
|
||||
//判断是否领取过
|
||||
$have = $this->dataInfo(['user_id'=>$user_id,'coupon_id'=>$coupon_id]);
|
||||
|
||||
if(!empty($have)){
|
||||
|
||||
return ['code'=>500,'msg'=>'你已经领取过了'];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
$insert = [
|
||||
|
||||
'uniacid' => $coupon['uniacid'],
|
||||
|
||||
'user_id' => $user_id,
|
||||
|
||||
'coupon_id' => $coupon_id,
|
||||
|
||||
'title' => $coupon['title'],
|
||||
|
||||
'type' => $coupon['type'],
|
||||
|
||||
'full' => $coupon['full'],
|
||||
|
||||
'discount' => $coupon['discount'],
|
||||
|
||||
'rule' => $coupon['rule'],
|
||||
|
||||
'text' => $coupon['text'],
|
||||
|
||||
'num' => $num,
|
||||
|
||||
'start_time'=> $coupon['time_limit']==1?time():$coupon['start_time'],
|
||||
|
||||
'end_time' => $coupon['time_limit']==1?time()+$coupon['day']*86400:$coupon['end_time'],
|
||||
|
||||
];
|
||||
|
||||
$res = $this->dataAdd($insert);
|
||||
|
||||
if($res==0){
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
$record_id = $this->getLastInsID();
|
||||
|
||||
if($coupon['send_type']==2){
|
||||
//修改优惠券库存
|
||||
$res = $coupon_model->dataUpdate(['id'=>$coupon_id,'i'=>$coupon['i']],['stock'=>$coupon['stock']-$num,'i'=>$coupon['i']+1]);
|
||||
|
||||
if($res==0){
|
||||
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$list = [
|
||||
|
||||
1 => $coupon['service'],
|
||||
|
||||
2 => $coupon['shop_goods'],
|
||||
|
||||
3 => $coupon['restaurant_goods'],
|
||||
];
|
||||
|
||||
$coupon_goods_model = new CouponService();
|
||||
//给优惠券添加限用商品等
|
||||
foreach ($list as $ks=>$vs){
|
||||
|
||||
if(!empty($vs)){
|
||||
|
||||
foreach ($vs as $vv){
|
||||
|
||||
$insert = [
|
||||
|
||||
'uniacid' => $coupon['uniacid'],
|
||||
|
||||
'type' => 1,
|
||||
|
||||
'goods_id' => $vv['goods_id'],
|
||||
|
||||
'coupon_id'=> $record_id,
|
||||
|
||||
'scene' => $ks
|
||||
];
|
||||
|
||||
$res = $coupon_goods_model->insert($insert);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-08-29 23:02
|
||||
* @功能说明:退换优惠券
|
||||
*/
|
||||
public function couponRefund($order_id){
|
||||
|
||||
$order_model = new Order();
|
||||
|
||||
$coupon_id = $order_model->where(['id'=>$order_id])->value('coupon_id');
|
||||
|
||||
if(!empty($coupon_id)){
|
||||
|
||||
$this->dataUpdate(['id'=>$coupon_id],['status'=>1,'use_time'=>0,'order_id'=>0]);
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-13 09:34
|
||||
* @功能说明:使用优惠券
|
||||
*/
|
||||
public function couponUse($coupon_id,$order_id){
|
||||
|
||||
$record = $this->dataInfo(['id'=>$coupon_id]);
|
||||
|
||||
if($record['num']>1){
|
||||
|
||||
$this->dataUpdate(['id'=>$coupon_id],['num'=>$record['num']-1]);
|
||||
|
||||
unset($record['id']);
|
||||
|
||||
if(isset($record['goods'])){
|
||||
|
||||
unset($record['goods']);
|
||||
}
|
||||
|
||||
if(isset($record['shop_goods'])){
|
||||
|
||||
unset($record['shop_goods']);
|
||||
}
|
||||
|
||||
if(isset($record['restaurant_goods'])){
|
||||
|
||||
unset($record['restaurant_goods']);
|
||||
}
|
||||
|
||||
$record['pid'] = $coupon_id;
|
||||
|
||||
$record['num'] = 1;
|
||||
|
||||
$record['status'] = 2;
|
||||
|
||||
$record['use_time'] = time();
|
||||
|
||||
$record['order_id'] = $order_id;
|
||||
|
||||
$this->insert($record);
|
||||
|
||||
$coupon_id = $this->getLastInsID();
|
||||
|
||||
}else{
|
||||
|
||||
$this->dataUpdate(['id'=>$coupon_id],['status'=>2,'use_time'=>time(),'order_id'=>$order_id]);
|
||||
|
||||
}
|
||||
|
||||
return $coupon_id;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
161
app/massage/model/CouponService.php
Normal file
161
app/massage/model/CouponService.php
Normal file
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class CouponService extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'massage_service_coupon_goods';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function goodsUpdate($dis,$data){
|
||||
|
||||
$spe = $data['spe'];
|
||||
|
||||
unset($data['spe']);
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
$this->updateSome($dis['id'],$data['uniacid'],$spe);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @param $uniacid
|
||||
* @param $spe
|
||||
* @功能说明:
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-23 13:35
|
||||
*/
|
||||
public function updateSome($id,$uniacid,$coach){
|
||||
|
||||
$spe_model = new GoodsSpe();
|
||||
|
||||
$spe_model->where(['goods_id'=>$id])->delete();
|
||||
|
||||
if(!empty($spe)){
|
||||
|
||||
foreach ($spe as $value){
|
||||
|
||||
$value['uniacid'] = $uniacid;
|
||||
|
||||
$value['goods_id'] = $id;
|
||||
|
||||
$spe_model->dataAdd($value);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page){
|
||||
|
||||
$data = $this->where($dis)->order('top desc,id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-11-01 15:43
|
||||
* @功能说明:优惠券
|
||||
*/
|
||||
public function eventCoupon($id,$data){
|
||||
|
||||
if(!empty($data['service'])){
|
||||
|
||||
foreach ($data['service'] as $value){
|
||||
|
||||
$insert['uniacid'] = $data['uniacid'];
|
||||
|
||||
$insert['coupon_id'] = $id;
|
||||
|
||||
$insert['goods_id'] = $value;
|
||||
|
||||
$this->dataAdd($insert);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
358
app/massage/model/Goods.php
Normal file
358
app/massage/model/Goods.php
Normal file
@@ -0,0 +1,358 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class Goods extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'shequshop_car_goods';
|
||||
|
||||
|
||||
protected $append = [
|
||||
|
||||
'create_time_text',
|
||||
|
||||
'car_type'
|
||||
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-22 10:53
|
||||
* @功能说明:
|
||||
*/
|
||||
public function getCarTypeAttr($value,$data){
|
||||
|
||||
if(!empty($data['id'])){
|
||||
|
||||
$car_connect_type = new CarTypeConnect();
|
||||
|
||||
$dis = [
|
||||
|
||||
'order_goods_id' => 0,
|
||||
|
||||
'goods_id' => $data['id']
|
||||
];
|
||||
|
||||
$list = $car_connect_type->where($dis)->column('type_id');
|
||||
|
||||
return array_values($list);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-10-12 14:17
|
||||
* @功能说明:判断该车型是否在使用
|
||||
*/
|
||||
public function carTypeHave($car_type_id){
|
||||
|
||||
$dis [] = ['a.status','>',-1];
|
||||
|
||||
$dis [] = ['b.type_id','>',$car_type_id];
|
||||
|
||||
$data = $this->alias('a')
|
||||
->join('shequshop_car_cartype_connect b','a.id = b.goods_id')
|
||||
->where($dis)
|
||||
->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @功能说明:
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-23 11:12
|
||||
*/
|
||||
public function getImgsAttr($value,$data){
|
||||
|
||||
if(!empty($value)){
|
||||
|
||||
return explode(',',$value);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-23 11:12
|
||||
* @功能说明:
|
||||
*/
|
||||
public function getCreateTimeTextAttr($value,$data){
|
||||
|
||||
if(!empty($data['create_time'])){
|
||||
|
||||
return date('Y-m-d H:i:s',$data['create_time']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-22 10:46
|
||||
* @功能说明:添加车型
|
||||
*/
|
||||
public function updateSome($car_type,$id,$uniacid){
|
||||
|
||||
$car_connect_type = new CarTypeConnect();
|
||||
|
||||
$dis = [
|
||||
|
||||
'order_goods_id' => 0,
|
||||
|
||||
'goods_id' => $id
|
||||
];
|
||||
|
||||
$car_connect_type->where($dis)->delete();
|
||||
|
||||
if(!empty($car_type)){
|
||||
|
||||
foreach ($car_type as $k=> $value){
|
||||
|
||||
$insert[$k]['goods_id'] = $id;
|
||||
|
||||
$insert[$k]['uniacid'] = $uniacid;
|
||||
|
||||
$insert[$k]['type_id'] = $value;
|
||||
|
||||
}
|
||||
|
||||
$car_connect_type->saveAll($insert);
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$data['create_time'] = time();
|
||||
|
||||
if(isset($data['car_type'])){
|
||||
|
||||
$car_type = $data['car_type'];
|
||||
|
||||
unset($data['car_type']);
|
||||
}
|
||||
|
||||
// $data['imgs'] = !empty($data['imgs'])?implode(',',$data['imgs']):'';
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
if(!empty($car_type)){
|
||||
|
||||
$id = $this->getLastInsID();
|
||||
|
||||
$this->updateSome($car_type,$id,$data['uniacid']);
|
||||
}
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
if(isset($data['car_type'])){
|
||||
|
||||
$car_type = $data['car_type'];
|
||||
|
||||
unset($data['car_type']);
|
||||
}
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
if(!empty($car_type)){
|
||||
|
||||
$this->updateSome($car_type,$data['id'],$data['uniacid']);
|
||||
}
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// /**
|
||||
// * @author chenniang
|
||||
// * @DataTime: 2020-09-29 11:05
|
||||
// * @功能说明:编辑
|
||||
// */
|
||||
// public function dataUpdate($dis,$data){
|
||||
//
|
||||
// $res = $this->where($dis)->update($data);
|
||||
//
|
||||
// return $res;
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page){
|
||||
|
||||
$data = $this->where($dis)->order('top desc,id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function indexDataList($dis,$page,$sort){
|
||||
|
||||
$data = $this->where($dis)->order("$sort,id desc")->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-07 10:21
|
||||
* @功能说明:服务技师列表
|
||||
*/
|
||||
public function serviceCoachList($dis){
|
||||
|
||||
$data = $this->alias('a')
|
||||
->join('massage_service_service_coach b','a.id = b.ser_id')
|
||||
->where($dis)
|
||||
->field(['a.*'])
|
||||
->order('a.id desc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-18 10:07
|
||||
* @功能说明:增加|减少库存 增加|减少销量
|
||||
*/
|
||||
public function setOrDelStock($goods_id,$num,$type=2){
|
||||
|
||||
if(empty($goods_id)){
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
$goods_info = $this->dataInfo(['id'=>$goods_id]);
|
||||
//退货
|
||||
if($type==1){
|
||||
|
||||
$update = [
|
||||
|
||||
'true_sale' => $goods_info['true_sale']-$num,
|
||||
|
||||
'total_sale'=> $goods_info['total_sale']-$num,
|
||||
|
||||
'lock' => $goods_info['lock']+1,
|
||||
|
||||
];
|
||||
//如果是售后增加退款数量
|
||||
// if($refund==1){
|
||||
//
|
||||
// $update['refund_num'] = $goods_info['refund_num']+$num;
|
||||
// }
|
||||
//减销量 加退款数量
|
||||
$res = $this->where(['id'=>$goods_id,'lock'=>$goods_info['lock']])->update($update);
|
||||
|
||||
if($res!=1){
|
||||
|
||||
return ['code'=>500,'msg'=>'提交失败'];
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
$update = [
|
||||
|
||||
'true_sale' => $goods_info['true_sale']+$num,
|
||||
|
||||
'total_sale'=> $goods_info['total_sale']+$num,
|
||||
|
||||
'lock' => $goods_info['lock']+1,
|
||||
|
||||
];
|
||||
|
||||
//增加销量
|
||||
$res = $this->where(['id'=>$goods_id,'lock'=>$goods_info['lock']])->update($update);
|
||||
|
||||
if($res!=1){
|
||||
|
||||
return ['code'=>500,'msg'=>'提交失败'];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
75
app/massage/model/GoodsSpe.php
Normal file
75
app/massage/model/GoodsSpe.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class GoodsSpe extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'shequshop_school_goods_spe';
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page){
|
||||
|
||||
$data = $this->where($dis)->order('id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
94
app/massage/model/Lable.php
Normal file
94
app/massage/model/Lable.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class Lable extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'massage_service_lable';
|
||||
|
||||
|
||||
//
|
||||
// public function getCreateTimeAttr($value,$data){
|
||||
//
|
||||
// if(!empty($value)){
|
||||
//
|
||||
// return date('Y-m-d H:i:s',$value);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$data['create_time'] = time();
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page=10){
|
||||
|
||||
$data = $this->where($dis)->order('top desc,id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
91
app/massage/model/Machine.php
Normal file
91
app/massage/model/Machine.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class Machine extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'lbfarm_machine';
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page){
|
||||
|
||||
$data = $this->where($dis)->order('status desc,id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-19 16:08
|
||||
* @功能说明:开启默认
|
||||
*/
|
||||
public function updateOne($id){
|
||||
|
||||
$user_id = $this->where(['id'=>$id])->value('user_id');
|
||||
|
||||
$res = $this->where(['user_id'=>$user_id])->where('id','<>',$id)->update(['status'=>0]);
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
105
app/massage/model/NoticeList.php
Normal file
105
app/massage/model/NoticeList.php
Normal file
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class NoticeList extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'massage_service_notice_list';
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-16 10:44
|
||||
* @功能说明:
|
||||
*/
|
||||
public function getCreateTimeAttr($value,$data){
|
||||
|
||||
if(!empty($value)){
|
||||
|
||||
return date('Y-m-d H:i:s',$value);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($uniacid,$order_id,$type=1){
|
||||
|
||||
$data['uniacid'] = $uniacid;
|
||||
|
||||
$data['order_id'] = $order_id;
|
||||
|
||||
$data['type'] = $type;
|
||||
|
||||
$data['create_time'] = time();
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page){
|
||||
|
||||
$data = $this->where($dis)->order('id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
if(empty($data)){
|
||||
|
||||
$this->dataAdd($dis);
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
}
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
1018
app/massage/model/Order.php
Normal file
1018
app/massage/model/Order.php
Normal file
File diff suppressed because it is too large
Load Diff
137
app/massage/model/OrderAddress.php
Normal file
137
app/massage/model/OrderAddress.php
Normal file
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class OrderAddress extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'massage_service_order_address';
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page){
|
||||
|
||||
$data = $this->where($dis)->order('id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-22 10:34
|
||||
* @功能说明:添加下单地址
|
||||
*/
|
||||
public function orderAddressAdd($address_id,$order_id){
|
||||
|
||||
if(empty($address_id)){
|
||||
|
||||
return ['code'=>500,'msg'=>'请选择下单地址'];
|
||||
}
|
||||
|
||||
$address_model = new Address();
|
||||
|
||||
$address = $address_model->dataInfo(['id'=>$address_id]);
|
||||
|
||||
if(empty($address)){
|
||||
|
||||
return ['code'=>500,'msg'=>'下单地址已删除'];
|
||||
|
||||
}
|
||||
|
||||
$insert = [
|
||||
|
||||
'uniacid' => $address['uniacid'],
|
||||
|
||||
'order_id' => $order_id,
|
||||
|
||||
'user_name'=> $address['user_name'],
|
||||
|
||||
'mobile' => $address['mobile'],
|
||||
|
||||
'province' => $address['province'],
|
||||
|
||||
'city' => $address['city'],
|
||||
|
||||
'area' => $address['area'],
|
||||
|
||||
'lng' => $address['lng'],
|
||||
|
||||
'lat' => $address['lat'],
|
||||
|
||||
'address' => $address['address'],
|
||||
|
||||
'address_info' => $address['address_info'],
|
||||
|
||||
];
|
||||
|
||||
$res = $this->dataAdd($insert);
|
||||
|
||||
if($res!=1){
|
||||
|
||||
return ['code'=>500,'msg'=>'下单失败'];
|
||||
|
||||
}
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
260
app/massage/model/OrderGoods.php
Normal file
260
app/massage/model/OrderGoods.php
Normal file
@@ -0,0 +1,260 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class OrderGoods extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'shequshop_car_order_goods';
|
||||
|
||||
|
||||
protected $append = [
|
||||
|
||||
'refund_num'
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @功能说明:获取退款的数量
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-04-12 10:46
|
||||
*/
|
||||
public function getRefundNumAttr($value,$data){
|
||||
|
||||
if(!empty($data['id'])){
|
||||
|
||||
$refund_model = new RefundOrder();
|
||||
|
||||
$num = $refund_model->refundNum($data['id']);
|
||||
|
||||
return $num;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page){
|
||||
|
||||
$data = $this->where($dis)->order('id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataSelect($dis){
|
||||
|
||||
$data = $this->where($dis)->order('id desc')->select()->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-22 11:12
|
||||
* @功能说明:添加商品子订单
|
||||
*/
|
||||
public function orderGoodsAdd($order_goods,$order_id,$user_id){
|
||||
|
||||
$goods_model = new Goods();
|
||||
|
||||
$car_model = new Car();
|
||||
|
||||
foreach ($order_goods as $v){
|
||||
|
||||
// $ser_status = $goods_model->where(['id'=>$v['goods_id']])->value('status');
|
||||
|
||||
$goods = $goods_model->dataInfo(['id'=>$v['goods_id']]);
|
||||
|
||||
if($goods['status']!=1){
|
||||
|
||||
return ['code'=>500,'msg'=>'商品已经下架'];
|
||||
}
|
||||
|
||||
$res = $this->checkIdentity($goods,$user_id);
|
||||
|
||||
if(!empty($res['code'])){
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
$insert = [
|
||||
|
||||
'uniacid' => $v['uniacid'],
|
||||
|
||||
'order_id' => $order_id,
|
||||
|
||||
'user_id' => $user_id,
|
||||
|
||||
'pay_type' => 1,
|
||||
|
||||
'goods_name' => $v['title'],
|
||||
|
||||
'goods_cover' => $v['cover'],
|
||||
|
||||
'goods_price' => $v['price'],
|
||||
|
||||
'true_price' => round($v['true_price']/$v['num'],5),
|
||||
|
||||
'pay_price' => round($v['true_price'],2),
|
||||
|
||||
'num' => $v['num'],
|
||||
|
||||
'can_refund_num' => $v['num'],
|
||||
|
||||
'goods_id' => $v['goods_id'],
|
||||
|
||||
'circle' => $goods['number'],
|
||||
|
||||
'car_type_id' => $goods['car_type_id'],
|
||||
|
||||
|
||||
];
|
||||
|
||||
$res = $this->dataAdd($insert);
|
||||
|
||||
if($res!=1){
|
||||
|
||||
return ['code'=>500,'msg'=>'下单失败'];
|
||||
}
|
||||
|
||||
$order_goods_id = $this->getLastInsID();
|
||||
|
||||
$this->updateSome($v,$order_goods_id);
|
||||
}
|
||||
//删除购物车
|
||||
$res = $car_model->where(['user_id'=>$user_id,'status'=>1])->delete();
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-23 17:33
|
||||
* @功能说明:检查购买者身份
|
||||
*/
|
||||
public function checkIdentity($goods,$user_id){
|
||||
|
||||
$driver_model = new CarDriver();
|
||||
//查看是否是专业赛车手
|
||||
$info = $driver_model->dataInfo(['user_id'=>$user_id,'status'=>2]);
|
||||
|
||||
$car_type_model = new CarType();
|
||||
|
||||
$car_type = $car_type_model->dataInfo(['id'=>$goods['car_type_id']]);
|
||||
|
||||
if(!empty($info)&&empty($car_type['major'])){
|
||||
|
||||
return ['code'=>500,'msg'=>$goods['title'].'只有普通车手可购买'];
|
||||
}
|
||||
|
||||
if(empty($info)&&empty($car_type['norm'])){
|
||||
|
||||
return ['code'=>50001,'msg'=>$goods['title'].'只有专业车手可购买'];
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-22 10:46
|
||||
* @功能说明:添加车型
|
||||
*/
|
||||
public function updateSome($order_goods,$order_goods_id){
|
||||
|
||||
$car_connect_type = new CarTypeConnect();
|
||||
|
||||
|
||||
$car_type = $car_connect_type->where(['order_goods_id'=>0,'goods_id'=>$order_goods['goods_id']])->column('type_id');
|
||||
|
||||
if(!empty($car_type)){
|
||||
|
||||
foreach ($car_type as $k=> $value){
|
||||
|
||||
$insert[$k]['goods_id'] = $order_goods['goods_id'];
|
||||
|
||||
$insert[$k]['uniacid'] = $order_goods['uniacid'];
|
||||
|
||||
$insert[$k]['order_goods_id'] = $order_goods_id;
|
||||
|
||||
$insert[$k]['type_id'] = $value;
|
||||
|
||||
}
|
||||
|
||||
$car_connect_type->saveAll($insert);
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
83
app/massage/model/PayConfig.php
Normal file
83
app/massage/model/PayConfig.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class PayConfig extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'lbfarm_pay_config';
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page){
|
||||
|
||||
$data = $this->where($dis)->order('id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
if(empty($data)){
|
||||
|
||||
$this->dataAdd($dis);
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
}
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
442
app/massage/model/Printer.php
Normal file
442
app/massage/model/Printer.php
Normal file
@@ -0,0 +1,442 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use app\restaurant\model\Table;
|
||||
use think\facade\Db;
|
||||
|
||||
class Printer extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'massage_service_printer';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page){
|
||||
|
||||
$data = $this->where($dis)->order('id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
if(empty($data)){
|
||||
|
||||
$this->dataAdd($dis);
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
}
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-11-11 09:25
|
||||
* @功能说明:订单打印
|
||||
*/
|
||||
public function userOrder($id){
|
||||
|
||||
$order_model = new Order();
|
||||
//订单信息
|
||||
$order = $order_model->dataInfo(['id'=>$id]);
|
||||
|
||||
$brs = "<BR>";
|
||||
|
||||
$orderInfo = '<CB>'.'订单小票'.'</CB><BR>';
|
||||
|
||||
$orderInfo .= '--------------------------------'.$brs;
|
||||
|
||||
|
||||
$orderInfo .= '服务/数量/价格'.$brs;
|
||||
|
||||
$orderInfo .= '--------------------------------'.$brs;
|
||||
|
||||
|
||||
foreach ($order['order_goods'] as $v) {
|
||||
|
||||
$v['goods_name'] = mb_convert_encoding($v['goods_name'], "UTF-8", "auto");
|
||||
|
||||
$orderInfo .= $v['goods_name'].$brs;
|
||||
|
||||
$orderInfo .= ' X'.$v['num'].' '.round($v['true_price']*$v['num'],2).'元'.$brs;
|
||||
// $orderInfo .= round($v['true_price']*$v['num'],2).'元'.$brs;
|
||||
|
||||
$orderInfo .= ''.$brs;
|
||||
|
||||
$orderInfo .= ''.$brs;
|
||||
|
||||
}
|
||||
|
||||
|
||||
$coach_model = new Coach();
|
||||
|
||||
$address_model = new OrderAddress();
|
||||
|
||||
$coach_name = $coach_model->where(['id'=>$order['coach_id']])->value('coach_name');
|
||||
|
||||
$user_name = $address_model->where(['order_id'=>$order['id']])->value('user_name');
|
||||
|
||||
$orderInfo .= '预约技师:'.$coach_name.$brs;
|
||||
|
||||
$orderInfo .= '下单人:'.$user_name.$brs;
|
||||
|
||||
$time = date('Y-m-d H:i',$order['start_time']).'-'.date('Y-m-d H:i',$order['end_time']);
|
||||
|
||||
$orderInfo .= '预约时间:'.$time.$brs;
|
||||
|
||||
$orderInfo .= '预约金额:'.round($order['pay_price'],2).$brs;
|
||||
|
||||
$orderInfo .= '付款时间:'.date('Y-m-d H:i',$order['pay_time']).$brs;
|
||||
|
||||
return $orderInfo;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-11-11 10:20
|
||||
* @功能说明:打印
|
||||
*/
|
||||
public function orderPrinter($orderInfo,$aotu=1,$type=1){
|
||||
|
||||
$dis = [
|
||||
|
||||
'status' => 1,
|
||||
];
|
||||
|
||||
if($aotu==1){
|
||||
|
||||
$dis['auto'] =1;
|
||||
}
|
||||
|
||||
if($type==1){
|
||||
|
||||
$dis['is_car'] = 1;
|
||||
|
||||
}elseif($type==2){
|
||||
|
||||
$dis['is_shop'] = 1;
|
||||
|
||||
}else{
|
||||
|
||||
$dis['is_restaurant'] = 1;
|
||||
|
||||
}
|
||||
|
||||
$printer_config = $this->where($dis)->select()->toArray();
|
||||
|
||||
if(!empty($printer_config)){
|
||||
|
||||
foreach ($printer_config as $value){
|
||||
|
||||
$value['ukey'] = $value['api_key'];
|
||||
|
||||
$value['sn'] = $value['printer_key'];
|
||||
//用户小票
|
||||
$res = \longbingcore\printer\Printer::FeiePrintMsg($value,$orderInfo,'Open_printMsg',$value['user_ticket_num']);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-11-12 09:57
|
||||
* @功能说明:打印
|
||||
*
|
||||
* type 1赛车 2商城 3 餐饮
|
||||
*/
|
||||
public function printer($id,$aotu=1,$type=1){
|
||||
|
||||
if($type==1){
|
||||
|
||||
$user_order = $this->carOrder($id);
|
||||
|
||||
}elseif ($type==2){
|
||||
|
||||
$user_order = $this->shopOrder($id);
|
||||
|
||||
}else{
|
||||
|
||||
$user_order = $this->restaurantOrder($id);
|
||||
|
||||
}
|
||||
//打印
|
||||
$res = $this->orderPrinter($user_order,$aotu,$type);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-11-11 09:25
|
||||
* @功能说明:商城订单打印
|
||||
*/
|
||||
public function shopOrder($id){
|
||||
|
||||
$order_model = new \app\shop\model\Order();
|
||||
//订单信息
|
||||
$order = $order_model->dataInfo(['id'=>$id]);
|
||||
|
||||
$brs = "<BR>";
|
||||
|
||||
$orderInfo = '<CB>'.'商城订单小票'.'</CB><BR>';
|
||||
|
||||
$orderInfo .= '订单号:'.$order['order_code'].$brs;
|
||||
|
||||
$orderInfo .= '下单时间:'.date('Y-m-d H:i:s',$order['create_time']).$brs;
|
||||
|
||||
$orderInfo .= '--------------------------------'.$brs;
|
||||
|
||||
$orderInfo .= '商品/规格/数量/价格'.$brs;
|
||||
|
||||
$orderInfo .= '--------------------------------'.$brs;
|
||||
|
||||
foreach ($order['order_goods'] as $v) {
|
||||
|
||||
$v['goods_name'] = mb_convert_encoding($v['goods_name'], "UTF-8", "auto");
|
||||
|
||||
$orderInfo .= $v['goods_name'].$brs;
|
||||
|
||||
$orderInfo .= '【'.$v['spe_name'].'】'.$brs;
|
||||
|
||||
$orderInfo .= ' X'.$v['goods_num'].' '.round($v['pay_price'],2).'元'.$brs;
|
||||
|
||||
$orderInfo .= ''.$brs;
|
||||
|
||||
$orderInfo .= ''.$brs;
|
||||
|
||||
}
|
||||
$orderInfo .= '--------------------------------'.$brs;
|
||||
|
||||
if($order['send_type']==1){
|
||||
|
||||
$orderInfo .= '配送方式:自提'.$brs;
|
||||
|
||||
}else{
|
||||
|
||||
$orderInfo .= '配送方式:快递'.$brs;
|
||||
|
||||
$orderInfo .= '物流费:'.$order['freight'].$brs;
|
||||
|
||||
$orderInfo .= ''.$brs;
|
||||
|
||||
$orderInfo .= ''.$brs;
|
||||
}
|
||||
|
||||
$orderInfo .= '原价:'.$order['init_price'].$brs;
|
||||
|
||||
$orderInfo .= '优惠:'.round($order['init_price']-$order['pay_price'],2).$brs;
|
||||
|
||||
$orderInfo .= '实付:'.$order['pay_price'].$brs;
|
||||
|
||||
$address_model = new OrderAddress();
|
||||
|
||||
$user = $address_model->dataInfo(['order_id'=>$order['id'],'type'=>2]);
|
||||
//自提
|
||||
$orderInfo .= $user['address'].$user['address_info'].$brs;
|
||||
|
||||
$orderInfo .= $user['user_name'].' '.$user['mobile'].$brs;
|
||||
|
||||
$orderInfo .= '备注:'.$order['text'].$brs;
|
||||
|
||||
return $orderInfo;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-11-11 09:25
|
||||
* @功能说明:餐饮订单打印
|
||||
*/
|
||||
public function restaurantOrder($id){
|
||||
|
||||
$order_model = new \app\restaurant\model\Order();
|
||||
//订单信息
|
||||
$order = $order_model->dataInfo(['id'=>$id]);
|
||||
|
||||
$table_model = new Table();
|
||||
|
||||
$table_title = $table_model->where(['id'=>$order['table_id']])->value('title');
|
||||
|
||||
$brs = "<BR>";
|
||||
|
||||
$orderInfo = '<CB>'.'餐饮订单小票'.'</CB><BR>';
|
||||
|
||||
$orderInfo .= '订单号:'.$order['order_code'].$brs;
|
||||
|
||||
$orderInfo .= '人数:'.$order['user_num'].$brs;
|
||||
|
||||
$orderInfo .= '桌号:'.$table_title.$brs;
|
||||
|
||||
$orderInfo .= '下单时间:'.date('Y-m-d H:i:s',$order['create_time']).$brs;
|
||||
|
||||
$orderInfo .= '--------------------------------'.$brs;
|
||||
|
||||
$orderInfo .= '商品/规格/数量/价格'.$brs;
|
||||
|
||||
$orderInfo .= '--------------------------------'.$brs;
|
||||
|
||||
foreach ($order['order_goods'] as $v) {
|
||||
|
||||
$v['goods_name'] = mb_convert_encoding($v['goods_name'], "UTF-8", "auto");
|
||||
|
||||
$orderInfo .= $v['goods_name'].$brs;
|
||||
|
||||
$orderInfo .= '【'.$v['spe_name'].'】'.$brs;
|
||||
|
||||
$orderInfo .= ' X'.$v['goods_num'].' '.round($v['pay_price'],2).'元'.$brs;
|
||||
|
||||
$orderInfo .= ''.$brs;
|
||||
|
||||
$orderInfo .= ''.$brs;
|
||||
|
||||
}
|
||||
$orderInfo .= '--------------------------------'.$brs;
|
||||
|
||||
$orderInfo .= '原价:'.$order['init_price'].$brs;
|
||||
|
||||
$orderInfo .= '优惠:'.round($order['init_price']-$order['pay_price'],2).$brs;
|
||||
|
||||
$orderInfo .= '实付:'.$order['pay_price'].$brs;
|
||||
|
||||
$user_model = new User();
|
||||
|
||||
$user = $user_model->dataInfo(['id'=>$order['user_id']]);
|
||||
|
||||
$orderInfo .= $user['nickName'].' '.$user['phone'].$brs;
|
||||
|
||||
$orderInfo .= '备注:'.$order['text'].$brs;
|
||||
|
||||
return $orderInfo;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-11-11 09:25
|
||||
* @功能说明:赛车订单打印
|
||||
*/
|
||||
public function carOrder($id){
|
||||
|
||||
$order_model = new Order();
|
||||
//订单信息
|
||||
$order = $order_model->dataInfo(['id'=>$id]);
|
||||
|
||||
$brs = "<BR>";
|
||||
|
||||
$orderInfo = '<CB>'.'赛车订单小票'.'</CB><BR>';
|
||||
|
||||
$orderInfo .= '订单号:'.$order['order_code'].$brs;
|
||||
|
||||
$orderInfo .= '下单时间:'.date('Y-m-d H:i:s',$order['create_time']).$brs;
|
||||
|
||||
$orderInfo .= '--------------------------------'.$brs;
|
||||
|
||||
$orderInfo .= '商品/数量/价格'.$brs;
|
||||
|
||||
$orderInfo .= '--------------------------------'.$brs;
|
||||
|
||||
foreach ($order['order_goods'] as $v) {
|
||||
|
||||
$v['goods_name'] = mb_convert_encoding($v['goods_name'], "UTF-8", "auto");
|
||||
|
||||
$orderInfo .= $v['goods_name'].$brs;
|
||||
|
||||
$orderInfo .= ' X'.$v['num'].' '.round($v['pay_price'],2).'元'.$brs;
|
||||
|
||||
$orderInfo .= ''.$brs;
|
||||
|
||||
$orderInfo .= ''.$brs;
|
||||
|
||||
}
|
||||
$orderInfo .= '--------------------------------'.$brs;
|
||||
|
||||
$orderInfo .= '原价:'.$order['init_price'].$brs;
|
||||
|
||||
$orderInfo .= '优惠:'.round($order['init_price']-$order['pay_price'],2).$brs;
|
||||
|
||||
$orderInfo .= '实付:'.$order['pay_price'].$brs;
|
||||
|
||||
$user_model = new User();
|
||||
|
||||
$user = $user_model->dataInfo(['id'=>$order['user_id']]);
|
||||
|
||||
$orderInfo .= $user['nickName'].' '.$user['phone'].$brs;
|
||||
|
||||
$orderInfo .= '备注:'.$order['text'].$brs;
|
||||
|
||||
return $orderInfo;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
795
app/massage/model/RefundOrder.php
Normal file
795
app/massage/model/RefundOrder.php
Normal file
@@ -0,0 +1,795 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\admin\model\ShopOrderRefund;
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class RefundOrder extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'massage_service_refund_order';
|
||||
|
||||
|
||||
|
||||
protected $append = [
|
||||
|
||||
'order_goods',
|
||||
|
||||
'all_goods_num',
|
||||
|
||||
'hx_user_text'
|
||||
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-09-23 16:52
|
||||
* @功能说明:
|
||||
*/
|
||||
public function getHxUserText($value,$data){
|
||||
|
||||
if(!empty($data['hx_user'])){
|
||||
|
||||
$user_model = new User();
|
||||
|
||||
$nickName = $user_model->where(['id'=>$data['user_id']])->value('nickName');
|
||||
|
||||
return $nickName;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-26 16:48
|
||||
* @功能说明:
|
||||
*/
|
||||
public function getImgsAttr($value,$data){
|
||||
|
||||
if(!empty($value)){
|
||||
|
||||
return explode(',',$value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @功能说明:总商品数量
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-25 14:39
|
||||
*/
|
||||
public function getAllGoodsNumAttr($value,$data){
|
||||
|
||||
if(!empty($data['id'])){
|
||||
|
||||
$order_goods_model = new RefundOrderGoods();
|
||||
|
||||
$dis = [
|
||||
|
||||
'refund_id' => $data['id']
|
||||
];
|
||||
|
||||
$num = $order_goods_model->where($dis)->sum('num');
|
||||
|
||||
return $num;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-17 17:16
|
||||
* @功能说明:收货信息
|
||||
*/
|
||||
public function getOrderGoodsAttr($value,$data){
|
||||
|
||||
if(!empty($data['id'])){
|
||||
|
||||
$goods_model = new RefundOrderGoods();
|
||||
|
||||
$info = $goods_model->dataSelect(['refund_id'=>$data['id']]);
|
||||
|
||||
return $info;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-15 14:37
|
||||
* @功能说明:后台列表
|
||||
*/
|
||||
public function adminDataList($dis,$page=10,$mapor=[]){
|
||||
|
||||
$data = $this->alias('a')
|
||||
->join('massage_service_refund_order_goods c','a.id = c.refund_id')
|
||||
->join('shequshop_car_order d','a.order_id = d.id')
|
||||
->where($dis)
|
||||
->where(function ($query) use ($mapor){
|
||||
$query->whereOr($mapor);
|
||||
})
|
||||
->field('a.*,d.order_code as pay_order_code,d.pay_price')
|
||||
->group('a.id')
|
||||
->order('a.id desc')
|
||||
->paginate($page)
|
||||
->toArray();
|
||||
|
||||
|
||||
if(!empty($data['data'])){
|
||||
|
||||
$user_model = new User();
|
||||
|
||||
foreach ($data['data'] as &$v){
|
||||
|
||||
$v['nickName'] = $user_model->where(['id'=>$v['user_id']])->value('nickName');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-19 17:46
|
||||
* @功能说明:小程序退款列表
|
||||
*/
|
||||
public function indexDataList($dis,$where=[],$page=10){
|
||||
|
||||
$data = $this->alias('a')
|
||||
->join('massage_service_refund_order_goods c','a.id = c.refund_id','left')
|
||||
->join('shequshop_car_order d','a.order_id = d.id','left')
|
||||
->where($dis)
|
||||
->where(function ($query) use ($where){
|
||||
$query->whereOr($where);
|
||||
})
|
||||
->field('a.*,d.order_code as pay_order_code')
|
||||
->group('a.id')
|
||||
->order('a.id desc')
|
||||
->paginate($page)
|
||||
->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-04-08 17:08
|
||||
* @功能说明:退款中
|
||||
*/
|
||||
public function refundIng($cap_id){
|
||||
|
||||
$dis = [
|
||||
|
||||
'cap_id' => $cap_id,
|
||||
|
||||
'status' => 1
|
||||
];
|
||||
|
||||
$count = $this->where($dis)->count();
|
||||
|
||||
return $count;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$data['status'] = 1;
|
||||
|
||||
$data['create_time'] = time();
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page){
|
||||
|
||||
$data = $this->where($dis)->order('id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-18 09:37
|
||||
* @功能说明:通过退款
|
||||
*/
|
||||
public function passOrder($id,$price,$payConfig,$refund_user=0,$text=''){
|
||||
|
||||
$refund_order= $this->dataInfo(['id'=>$id]);
|
||||
|
||||
$order_model = new Order();
|
||||
|
||||
$pay_order = $order_model->dataInfo(['id'=>$refund_order['order_id']]);
|
||||
|
||||
if($refund_order['status']!=1){
|
||||
|
||||
return ['code'=>500,'msg'=>'订单状态错误'];
|
||||
}
|
||||
|
||||
$update = [
|
||||
|
||||
'status' => 2,
|
||||
|
||||
'refund_time' => time(),
|
||||
|
||||
'refund_price'=> $price,
|
||||
|
||||
'refund_text' => $text
|
||||
];
|
||||
|
||||
// $comm_model = new Commission();
|
||||
|
||||
Db::startTrans();
|
||||
//分销佣金
|
||||
// $comm_model->refundComm($id);
|
||||
|
||||
|
||||
$res = $this->dataUpdate(['id'=>$refund_order['id']],$update);
|
||||
|
||||
if($res!=1){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
return ['code'=>500,'msg'=>'退款失败,请重试'];
|
||||
|
||||
}
|
||||
//修改退款子订单的退款状态
|
||||
$order_refund_goods = new RefundOrderGoods();
|
||||
|
||||
$res = $order_refund_goods->dataUpdate(['refund_id'=>$id],['status'=>2]);
|
||||
|
||||
if($res==0){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
return ['code'=>500,'msg'=>'退款失败,请重试1'.$res];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$order_update = [];
|
||||
|
||||
// if($refund_order['apply_price']>0){
|
||||
|
||||
// //服务费占总退款的比例
|
||||
// $ser_bin = $refund_order['service_price']/$refund_order['apply_price'];
|
||||
// //扣除退款后的服务费
|
||||
// $coach_price = $pay_order['true_service_price'] - $price*$ser_bin;
|
||||
//
|
||||
// $coach_price = $coach_price>0?round($coach_price,2):0;
|
||||
//
|
||||
// $order_update = [
|
||||
//
|
||||
//
|
||||
// 'true_service_price'=> $coach_price,
|
||||
//
|
||||
//
|
||||
// ];
|
||||
// }
|
||||
|
||||
//查看货是否退完了
|
||||
$refund_success = $this->checkRefundNum($refund_order['order_id']);
|
||||
//退完了 就修改订单状态
|
||||
if($refund_success==1){
|
||||
|
||||
$order_update['pay_type'] = -1;
|
||||
|
||||
if(!empty($pay_order['pay_type'])&&$pay_order['pay_type']<=3){
|
||||
//退换优惠券
|
||||
$coupon_model = new CouponRecord();
|
||||
|
||||
$coupon_model->couponRefund($pay_order['id']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!empty($order_update)){
|
||||
|
||||
$res = $order_model->dataUpdate(['id'=>$refund_order['order_id']],$order_update);
|
||||
|
||||
if($res!=1){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
return ['code'=>500,'msg'=>'退款失败,请重试2'];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//退款
|
||||
if($price>0){
|
||||
|
||||
$res = $this->refundCash($payConfig,$pay_order,$price,$id);
|
||||
|
||||
if(!empty($res['code'])){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
return ['code'=>500,'msg'=>$res['msg']];
|
||||
}
|
||||
|
||||
if($res!=true){
|
||||
|
||||
|
||||
Db::rollback();
|
||||
|
||||
return ['code'=>500,'msg'=>'退款失败,请重试2'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $payConfig
|
||||
* @param $pay_order
|
||||
* @param $price
|
||||
* @param int $refund_id
|
||||
* @功能说明:退钱
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-07-12 20:31
|
||||
*/
|
||||
public function refundCash($payConfig,$pay_order,$price,$refund_id=0){
|
||||
|
||||
$order_model = new Order();
|
||||
|
||||
if(empty($pay_order['balance'])){
|
||||
//微信退款
|
||||
$response = orderRefundApi($payConfig,$pay_order['pay_price'],$price,$pay_order['transaction_id']);
|
||||
//如果退款成功修改一下状态
|
||||
if ( isset( $response[ 'return_code' ] ) && isset( $response[ 'result_code' ] ) && $response[ 'return_code' ] == 'SUCCESS' && $response[ 'result_code' ] == 'SUCCESS' ) {
|
||||
|
||||
$response['out_refund_no'] = !empty($response['out_refund_no'])?$response['out_refund_no']:$pay_order['order_code'];
|
||||
|
||||
if(!empty($refund_id)){
|
||||
|
||||
$this->dataUpdate(['id'=>$refund_id],['out_refund_no'=>$response['out_refund_no']]);
|
||||
|
||||
}else{
|
||||
|
||||
$order_model->dataUpdate(['id'=>$pay_order['id']],['coach_refund_code'=>$response['out_refund_no']]);
|
||||
}
|
||||
|
||||
|
||||
}else {
|
||||
//失败就报错
|
||||
$discption = !empty($response['err_code_des'])?$response['err_code_des']:$response['return_msg'];
|
||||
|
||||
return ['code'=>500,'msg'=> $discption];
|
||||
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
$user_model = new User();
|
||||
|
||||
$water_model = new BalanceWater();
|
||||
|
||||
$user = $user_model->dataInfo(['id'=>$pay_order['user_id']]);
|
||||
//修改用户余额
|
||||
$res = $user_model->dataUpdate(['id'=>$pay_order['user_id']],['balance'=>$price+$user['balance']]);
|
||||
|
||||
if($res==0){
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
//添加余额流水
|
||||
$insert = [
|
||||
|
||||
'uniacid' => $pay_order['uniacid'],
|
||||
|
||||
'user_id' => $pay_order['user_id'],
|
||||
|
||||
'order_id'=> $pay_order['id'],
|
||||
|
||||
'price' => $price,
|
||||
|
||||
'add' => 1,
|
||||
|
||||
'type' => 2,
|
||||
|
||||
'before_balance' => $user['balance'],
|
||||
|
||||
'after_balance' => $price+$user['balance'],
|
||||
];
|
||||
|
||||
$res = $water_model->dataAdd($insert);
|
||||
|
||||
if($res==0){
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-18 10:29
|
||||
* @功能说明:检查改订单款退完了没
|
||||
*/
|
||||
public function checkRefundNum($order_id){
|
||||
|
||||
$order_goods_model = new OrderGoods();
|
||||
|
||||
$order_refund_goods_model = new RefundOrderGoods();
|
||||
|
||||
$order_model = new Order();
|
||||
|
||||
$dis = [
|
||||
|
||||
'order_id' => $order_id
|
||||
];
|
||||
|
||||
$goods_num = $order_goods_model->where($dis)->sum('num');
|
||||
|
||||
$dis['status'] = 2;
|
||||
|
||||
$refund_num= $order_refund_goods_model->where($dis)->sum('num');
|
||||
|
||||
return $refund_num>=$goods_num?1:0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-18 15:38
|
||||
* @功能说明:该天的退款
|
||||
*/
|
||||
public function datePrice($date,$uniacid,$cap_id=0,$end_time='',$type=1){
|
||||
|
||||
$end_time = !empty($end_time)?$end_time:$date+86399;
|
||||
|
||||
$dis = [];
|
||||
|
||||
$dis[] = ['status','=',2];
|
||||
|
||||
$dis[] = ['create_time','between',"$date,$end_time"];
|
||||
|
||||
$dis[] = ['uniacid',"=",$uniacid];
|
||||
|
||||
if(!empty($cap_id)){
|
||||
|
||||
$dis[] = ['cap_id','=',$cap_id];
|
||||
}
|
||||
|
||||
if($type==1){
|
||||
|
||||
$price = $this->where($dis)->sum('refund_price');
|
||||
|
||||
return round($price,2);
|
||||
|
||||
}else{
|
||||
|
||||
$count = $this->where($dis)->count();
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-26 13:33
|
||||
* @功能说明:申请退款
|
||||
*/
|
||||
public function applyRefund($order,$input){
|
||||
|
||||
$order_goods_model = new OrderGoods();
|
||||
|
||||
$refund_price = 0;
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
$list = $input['list'];
|
||||
|
||||
|
||||
foreach ($list as $k=>$value){
|
||||
|
||||
if(!empty($value['id'])){
|
||||
|
||||
$order_goods = $order_goods_model->dataInfo(['id'=>$value['id']]);
|
||||
|
||||
|
||||
if(empty($order_goods)){
|
||||
|
||||
return ['code'=>500,'msg'=>'商品未找到'];
|
||||
}
|
||||
|
||||
if($value['num']>$order_goods['can_refund_num']||$value['num']==0){
|
||||
|
||||
return ['code'=>500,'msg'=>'退款数量错误'];
|
||||
|
||||
}
|
||||
//退款金额
|
||||
$refund_price += $order_goods['true_price']*$value['num'];
|
||||
|
||||
$list[$k]['goods_id'] = $order_goods['goods_id'];
|
||||
|
||||
$list[$k]['goods_name'] = $order_goods['goods_name'];
|
||||
|
||||
$list[$k]['goods_cover'] = $order_goods['goods_cover'];
|
||||
|
||||
$list[$k]['goods_price'] = $order_goods['goods_price'];
|
||||
|
||||
$list[$k]['circle'] = $order_goods['circle'];
|
||||
|
||||
$res = $order_goods_model->where(['id'=>$value['id']])->update(['can_refund_num'=>$order_goods['can_refund_num']-$value['num']]);
|
||||
|
||||
if($res!=1){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
return ['code'=>500,'msg'=>'申请失败'];
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$car_price = 0;
|
||||
|
||||
if($refund_price<=0){
|
||||
|
||||
// Db::rollback();
|
||||
//
|
||||
// return ['code'=>500,'msg'=>'退款金额至少为0.01元'];
|
||||
}
|
||||
|
||||
$insert = [
|
||||
|
||||
'uniacid' => $order['uniacid'],
|
||||
|
||||
'user_id' => $order['user_id'],
|
||||
|
||||
'total_circle' => $order['total_circle'],
|
||||
|
||||
'order_code' => orderCode(),
|
||||
|
||||
'apply_price'=> round($refund_price,2),
|
||||
|
||||
'service_price'=> $refund_price,
|
||||
|
||||
'order_id' => $order['id'],
|
||||
|
||||
'text' => $input['text'],
|
||||
|
||||
'car_price' => $car_price,
|
||||
|
||||
'imgs' => !empty($input['imgs'])?implode(',',$input['imgs']):'',
|
||||
|
||||
'balance' => !empty($order['balance'])?$refund_price:0,
|
||||
|
||||
|
||||
];
|
||||
|
||||
$res = $this->dataAdd($insert);
|
||||
|
||||
if($res!=1){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
return ['code'=>500,'msg'=>'申请失败'];
|
||||
|
||||
}
|
||||
|
||||
$refund_id = $this->getLastInsID();
|
||||
|
||||
$refund_goods_model = new RefundOrderGoods();
|
||||
|
||||
foreach ($list as $value){
|
||||
|
||||
$insert = [
|
||||
|
||||
'uniacid' => $order['uniacid'],
|
||||
|
||||
'order_id' => $order['id'],
|
||||
|
||||
'refund_id' => $refund_id,
|
||||
|
||||
'order_goods_id' => $value['id'],
|
||||
|
||||
'goods_id' => $value['goods_id'],
|
||||
|
||||
'goods_name' => $value['goods_name'],
|
||||
|
||||
'goods_cover' => $value['goods_cover'],
|
||||
|
||||
'num' => $value['num'],
|
||||
|
||||
'goods_price' => $value['goods_price'],
|
||||
|
||||
'circle' => $value['circle'],
|
||||
|
||||
'status' => 1,
|
||||
];
|
||||
|
||||
$res = $refund_goods_model->dataAdd($insert);
|
||||
|
||||
if($res!=1){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
return ['code'=>500,'msg'=>'申请失败'];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
|
||||
return $refund_id;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-04-12 09:23
|
||||
* @功能说明:获取订单已经退款的数量
|
||||
*/
|
||||
public function refundNum($order_goods_id){
|
||||
|
||||
$dis = [
|
||||
|
||||
'b.order_goods_id' => $order_goods_id,
|
||||
|
||||
'a.status' => 2
|
||||
];
|
||||
|
||||
$num = $this->alias('a')
|
||||
->join('massage_service_refund_order_goods b','a.id = b.refund_id')
|
||||
->where($dis)
|
||||
->group('b.order_goods_id')
|
||||
->sum('b.num');
|
||||
|
||||
return $num;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-04-12 12:04
|
||||
* @功能说明:拒绝退款
|
||||
*/
|
||||
public function noPassRefund($refund_id){
|
||||
|
||||
$dis = [
|
||||
|
||||
'id' => $refund_id
|
||||
];
|
||||
|
||||
$refund_order = $this->dataInfo($dis);
|
||||
|
||||
if($refund_order['status']!=1){
|
||||
|
||||
return ['code'=>500,'msg'=>'退款状态错误'];
|
||||
|
||||
}
|
||||
|
||||
$update = [
|
||||
|
||||
'status' => 3,
|
||||
|
||||
'refund_time' => time()
|
||||
|
||||
];
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
$res = $this->dataUpdate($dis,$update);
|
||||
|
||||
if($res!=1){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
return ['code'=>500,'msg'=>'退款失败,请重试'];
|
||||
|
||||
}
|
||||
//修改退款子订单的退款状态
|
||||
$order_refund_goods = new RefundOrderGoods();
|
||||
|
||||
$res = $order_refund_goods->dataUpdate(['refund_id'=>$refund_id],['status'=>3]);
|
||||
|
||||
if($res!=1){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
return ['code'=>500,'msg'=>'退款失败,请重试'];
|
||||
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
89
app/massage/model/RefundOrderGoods.php
Normal file
89
app/massage/model/RefundOrderGoods.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class RefundOrderGoods extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'massage_service_refund_order_goods';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page){
|
||||
|
||||
$data = $this->where($dis)->order('id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataSelect($dis){
|
||||
|
||||
$data = $this->where($dis)->order('id desc')->select()->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
185
app/massage/model/SynMember.php
Normal file
185
app/massage/model/SynMember.php
Normal file
@@ -0,0 +1,185 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class SynMember extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'longbing_card_v2_restaurant_syn_member';
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$data['create_time'] = time();
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page=10){
|
||||
|
||||
$data = $this->where($dis)->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-18 14:33
|
||||
* @功能说明:
|
||||
*/
|
||||
public function datePrice($date,$uniacid,$cap_id,$end_time='',$type=1){
|
||||
|
||||
$end_time = !empty($end_time)?$end_time:$date+86399;
|
||||
|
||||
$dis = [];
|
||||
|
||||
$dis[] = ['status','=',2];
|
||||
|
||||
$dis[] = ['create_time','between',"$date,$end_time"];
|
||||
|
||||
$dis[] = ['uniacid',"=",$uniacid];
|
||||
|
||||
if(!empty($cap_id)){
|
||||
|
||||
$dis[] = ['cap_id','=',$cap_id];
|
||||
}
|
||||
|
||||
if($type==1){
|
||||
|
||||
$price = $this->where($dis)->sum('true_cash');
|
||||
|
||||
return round($price,2);
|
||||
|
||||
}else{
|
||||
|
||||
$count = $this->where($dis)->count();
|
||||
|
||||
return $count;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-18 16:06
|
||||
* @功能说明:
|
||||
*/
|
||||
public function adminList($dis,$page=10){
|
||||
|
||||
$data = $this->alias('a')
|
||||
->join('massage_service_coach_list b','a.coach_id = b.id')
|
||||
->where($dis)
|
||||
->field('a.*,b.coach_name')
|
||||
->group('a.id')
|
||||
->order('a.id desc')
|
||||
->paginate($page)
|
||||
->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-30 14:36
|
||||
* @功能说明:团长提现
|
||||
*/
|
||||
public function capCash($cap_id,$status=2,$type=0){
|
||||
|
||||
$dis = [
|
||||
|
||||
'coach_id' => $cap_id,
|
||||
|
||||
'status' => $status
|
||||
];
|
||||
|
||||
if(!empty($type)){
|
||||
|
||||
$dis['type'] = $type;
|
||||
}
|
||||
|
||||
$price = $this->where($dis)->sum('apply_price');
|
||||
|
||||
return round($price,2);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-30 14:36
|
||||
* @功能说明:团长提现
|
||||
*/
|
||||
public function capCashCount($cap_id,$status=2){
|
||||
|
||||
$dis = [
|
||||
|
||||
|
||||
'cap_id' => $cap_id,
|
||||
|
||||
'status' => $status
|
||||
];
|
||||
|
||||
$count = $this->where($dis)->count();
|
||||
|
||||
return $count;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
553
app/massage/model/User.php
Normal file
553
app/massage/model/User.php
Normal file
@@ -0,0 +1,553 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use app\member\model\Integral;
|
||||
use app\member\model\Level;
|
||||
use app\member\model\Log;
|
||||
use app\member\model\Rights;
|
||||
use longbingcore\wxcore\PospalApi;
|
||||
use think\facade\Db;
|
||||
|
||||
class User extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'massage_service_user_list';
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-08-29 21:18
|
||||
* @功能说明:余额
|
||||
*/
|
||||
public function getBalanceAttr($value,$data){
|
||||
|
||||
if(isset($value)&&isset($data['pal_balance'])){
|
||||
|
||||
return round($value+$data['pal_balance'],2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-10-27 14:49
|
||||
* @功能说明:积分
|
||||
*/
|
||||
public function getIntegralAttr($value,$data){
|
||||
|
||||
if(isset($value)&&isset($data['pal_point'])){
|
||||
|
||||
return $value+$data['pal_point'];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-08-29 21:18
|
||||
* @功能说明:
|
||||
*/
|
||||
public function getCashAttr($value,$data){
|
||||
|
||||
if(isset($value)){
|
||||
|
||||
return round($value,2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$data['create_time'] = time();
|
||||
|
||||
$data['status'] = 1;
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page,$mapor=[]){
|
||||
|
||||
$data = $this->where($dis)->where(function ($query) use ($mapor){
|
||||
$query->whereOr($mapor);
|
||||
})->order('id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-10-27 15:42
|
||||
* @功能说明:订单自提码
|
||||
*/
|
||||
public function orderQr($input,$uniacid){
|
||||
|
||||
$data = longbingCreateWxCode($uniacid,$input,$input['page']);
|
||||
|
||||
$data = transImagesOne($data ,['qr_path'] ,$uniacid);
|
||||
|
||||
$qr = $data['qr_path'];
|
||||
|
||||
return $qr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-10-27 15:14
|
||||
* @功能说明:向银豹同步积分和余额
|
||||
*/
|
||||
public function synBalanceAndPoint($user){
|
||||
|
||||
if(empty($user['customer_uid'])){
|
||||
|
||||
return false;
|
||||
}
|
||||
//余额
|
||||
$balance = $this->where(['id'=>$user['id']])->value('balance');
|
||||
//积分
|
||||
$integral= $this->where(['id'=>$user['id']])->value('integral');
|
||||
|
||||
if($balance<=0||$integral<=0){
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$data = [
|
||||
|
||||
1 => $balance,
|
||||
|
||||
2 => $integral
|
||||
];
|
||||
|
||||
$log = new Log();
|
||||
|
||||
$api = new PospalApi();
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
$res = $this->dataUpdate(['id'=>$user['id']],['balance'=>0,'integral'=>0]);
|
||||
|
||||
if($res==0){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
return ['code'=>500,'msg'=>'同步失败'];
|
||||
}
|
||||
//增加日志
|
||||
foreach ($data as $k=>$v){
|
||||
|
||||
if(!empty($v)){
|
||||
|
||||
$insert = [
|
||||
|
||||
'uniacid' => $user['uniacid'],
|
||||
|
||||
'user_id' => $user['id'],
|
||||
|
||||
'customer_uid' => $user['customer_uid'],
|
||||
|
||||
'type' => $k,
|
||||
|
||||
'value' => $v,
|
||||
|
||||
];
|
||||
|
||||
$log->dataAdd($insert);
|
||||
}
|
||||
|
||||
}
|
||||
//修改银豹的积分余额
|
||||
$res = $api->updateMemberCash($user['customer_uid'],$balance,$integral);
|
||||
|
||||
if($res['status']){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
return ['code'=>500,'msg'=>$res['messages'][0]];
|
||||
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-11-08 13:51
|
||||
* @功能说明:同步会员到本地
|
||||
*/
|
||||
public function synMemberList($uniacid=1,$update=0){
|
||||
|
||||
$key = 'syn_member';
|
||||
|
||||
$lock = getCache($key,$uniacid);
|
||||
|
||||
setCache($key,1,60,$uniacid);
|
||||
|
||||
if(!empty($lock)&&$update==0){
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$api_model = new PospalApi();
|
||||
|
||||
$member_model = new SynMember();
|
||||
|
||||
$check = 1;
|
||||
|
||||
$post_data = [];
|
||||
|
||||
$member_model->where(['uniacid'=>$uniacid])->delete();
|
||||
|
||||
while ($check==1){
|
||||
|
||||
$data = $api_model->getMemberList($post_data);
|
||||
|
||||
if($data['status']!='success'){
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
$pageSize = $data['data']['pageSize'];
|
||||
|
||||
$count = count($data['data']['result']);
|
||||
//可能有第二页
|
||||
if($count>=$pageSize){
|
||||
|
||||
$post_data = $data['postBackParameter'];
|
||||
|
||||
}else{
|
||||
|
||||
$check = 0;
|
||||
}
|
||||
|
||||
if(!empty($data['data']['result'])){
|
||||
|
||||
foreach ($data['data']['result'] as $k=>$v){
|
||||
|
||||
$insert[$k] = [
|
||||
|
||||
'uid' => $v['customerUid'],
|
||||
|
||||
'member_name' => $v['categoryName'],
|
||||
|
||||
'number' => $v['number'],
|
||||
|
||||
'name' => $v['name'],
|
||||
|
||||
'phone' => $v['phone'],
|
||||
|
||||
'discount' => $v['discount'],
|
||||
|
||||
'balance' => $v['balance'],
|
||||
|
||||
'point' => $v['point'],
|
||||
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
$member_model->saveAll($insert);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-11-08 16:46
|
||||
* @功能说明:同步会员余额积分
|
||||
*/
|
||||
public function synMemberCash($uniacid,$user_id){
|
||||
//查询所有
|
||||
$this->synMemberList($uniacid,1);
|
||||
|
||||
$member_model = new SynMember();
|
||||
|
||||
$dis = [
|
||||
|
||||
'uid' => $user_id
|
||||
];
|
||||
|
||||
$data = $member_model->dataInfo($dis);
|
||||
|
||||
if(empty($data)){
|
||||
|
||||
return ['code'=>500,'msg'=>'请先绑定会员'];
|
||||
|
||||
}
|
||||
|
||||
if(empty($data['balance'])&&empty($data['point'])){
|
||||
|
||||
return ['code'=>500,'msg'=>'你暂无可同步的余额和积分'];
|
||||
|
||||
}
|
||||
|
||||
$api_model = new PospalApi();
|
||||
|
||||
Db::startTrans();
|
||||
//扣除银豹平台的余额积分
|
||||
$res = $api_model->updateMemberCash($user_id,$data['balance']*-1,$data['point']*-1);
|
||||
|
||||
if($res['status']!='success'){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
return ['code'=>500,'msg'=>$res['messages'][0]];
|
||||
|
||||
}
|
||||
|
||||
$res = $member_model->dataUpdate($dis,['balance'=>0,'point'=>0]);
|
||||
|
||||
if($res==0){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
return ['code'=>500,'msg'=>'同步失败'];
|
||||
|
||||
}
|
||||
//给用户加余额积分
|
||||
$user_model = new User();
|
||||
|
||||
$user = $user_model->dataInfo(['customer_uid'=>$user_id]);
|
||||
|
||||
$update = [
|
||||
|
||||
'balance' => $user['balance']+$data['balance'],
|
||||
|
||||
];
|
||||
|
||||
$res = $user_model->dataUpdate(['customer_uid'=>$user_id],$update);
|
||||
|
||||
if($res==0){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
return ['code'=>500,'msg'=>'同步失败'];
|
||||
|
||||
}
|
||||
//增加余额日志
|
||||
if(!empty($data['balance'])){
|
||||
|
||||
$insert = [
|
||||
|
||||
'uniacid' => $uniacid,
|
||||
|
||||
'user_id' => $user['id'],
|
||||
|
||||
'type' => 5,
|
||||
|
||||
'add' => 1,
|
||||
|
||||
'price' => $data['balance'],
|
||||
|
||||
'before_balance' => $user['balance'],
|
||||
|
||||
'after_balance' => $user['balance']+$data['balance']
|
||||
];
|
||||
|
||||
$water_model = new BalanceWater();
|
||||
|
||||
$water_model->dataAdd($insert);
|
||||
}
|
||||
//增加积分日志
|
||||
if(!empty($data['point'])){
|
||||
|
||||
$i_model = new Integral();
|
||||
|
||||
$i_model->integralUserAdd($user['id'],$data['point'],$uniacid,2,7);
|
||||
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-10-27 16:08
|
||||
* @功能说明:初次同步会员信息
|
||||
*/
|
||||
public function getMemberInfoOne($user,$member_code){
|
||||
|
||||
// if(!empty($user['customer_uid'])){
|
||||
//
|
||||
// return ['code'=>500,'msg'=>'你已经同步过了'];
|
||||
// }
|
||||
|
||||
Db::startTrans();
|
||||
|
||||
$member_model = new SynMember();
|
||||
|
||||
$member_model->where(['user_id'=>$user['id']])->update(['user_id'=>0]);
|
||||
|
||||
$member = $member_model->dataInfo(['uid'=>$member_code]);
|
||||
|
||||
if(empty($member)){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
return ['code'=>500,'msg'=>'未找到会员'];
|
||||
|
||||
}
|
||||
|
||||
if(!empty($member['user_id'])){
|
||||
|
||||
Db::rollback();
|
||||
|
||||
return ['code'=>500,'msg'=>'该会员卡正在被别人使用'];
|
||||
|
||||
}
|
||||
|
||||
$member_model->where(['uid'=>$member_code])->update(['user_id'=>$user['id']]);
|
||||
|
||||
$level_model = new Level();
|
||||
//会员等级
|
||||
$level = $level_model->levelInfo(['title'=>$member['member_name']]);
|
||||
|
||||
$update = [
|
||||
|
||||
'member_id' => $member['number'],
|
||||
|
||||
'customer_uid' => $member['uid'],
|
||||
|
||||
'member_level' => !empty($level)?$level['id']:0,
|
||||
|
||||
];
|
||||
|
||||
$res = $this->dataUpdate(['id'=>$user['id']],$update);
|
||||
//给会员权益
|
||||
if(!empty($level['id'])){
|
||||
|
||||
$rights_model = new Rights();
|
||||
|
||||
$rights_model->giveRights($level['id'],$user['id']);
|
||||
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-10-27 16:24
|
||||
* @功能说明:同步会员 修改积分余额
|
||||
*/
|
||||
public function getMemberCashAndPoint($user){
|
||||
|
||||
if(empty($user['customer_uid'])){
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$api = new PospalApi();
|
||||
//根据会员号获取会员信息
|
||||
$member = $api->getMemberCode($user['customer_uid']);
|
||||
|
||||
if(empty($member['data'])){
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$update = [
|
||||
|
||||
'pal_balance' => $member['data']['balance'],
|
||||
|
||||
'pal_point' => $member['data']['point'],
|
||||
];
|
||||
|
||||
$res = $this->dataUpdate(['id'=>$user['id']],$update);
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-10-27 16:40
|
||||
* @功能说明:向银豹同步会员信息 然后银豹再向本地同步会员
|
||||
*/
|
||||
public function synMember($user){
|
||||
//向银豹同步
|
||||
$this->synBalanceAndPoint($user);
|
||||
//银豹向本地同步
|
||||
$this->getMemberCashAndPoint($user);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
206
app/massage/model/Wallet.php
Normal file
206
app/massage/model/Wallet.php
Normal file
@@ -0,0 +1,206 @@
|
||||
<?php
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class Wallet extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'lbfarm_farmer_wallet';
|
||||
|
||||
protected $append = [
|
||||
|
||||
'service_cash'
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-04-09 09:28
|
||||
* @功能说明:手续费
|
||||
*/
|
||||
public function getServiceCashAttr($value,$data){
|
||||
|
||||
if(isset($data['pay_price'])&&isset($data['true_price'])){
|
||||
|
||||
return round($data['pay_price']-$data['true_price'],2);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$data['create_time'] = time();
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page=10){
|
||||
|
||||
$data = $this->where($dis)->order('id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-18 14:33
|
||||
* @功能说明:
|
||||
*/
|
||||
public function datePrice($date,$uniacid,$cap_id,$end_time='',$type=1){
|
||||
|
||||
$end_time = !empty($end_time)?$end_time:$date+86399;
|
||||
|
||||
$dis = [];
|
||||
|
||||
$dis[] = ['status','=',2];
|
||||
|
||||
$dis[] = ['create_time','between',"$date,$end_time"];
|
||||
|
||||
$dis[] = ['uniacid',"=",$uniacid];
|
||||
|
||||
if(!empty($cap_id)){
|
||||
|
||||
$dis[] = ['cap_id','=',$cap_id];
|
||||
}
|
||||
|
||||
if($type==1){
|
||||
|
||||
$price = $this->where($dis)->sum('true_cash');
|
||||
|
||||
return round($price,2);
|
||||
|
||||
}else{
|
||||
|
||||
$count = $this->where($dis)->count();
|
||||
|
||||
return $count;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-18 16:06
|
||||
* @功能说明:
|
||||
*/
|
||||
public function adminList($dis,$page=10){
|
||||
|
||||
$data = $this->alias('a')
|
||||
->join('massage_service_coach_list b','a.coach_id = b.id')
|
||||
->where($dis)
|
||||
->field('a.*,b.coach_name')
|
||||
->group('a.id')
|
||||
->order('a.id desc')
|
||||
->paginate($page)
|
||||
->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-30 14:36
|
||||
* @功能说明:团长提现
|
||||
*/
|
||||
public function capCash($cap_id,$status=2,$type=0){
|
||||
|
||||
$dis = [
|
||||
|
||||
|
||||
'coach_id' => $cap_id,
|
||||
|
||||
'status' => $status
|
||||
];
|
||||
|
||||
if(!empty($type)){
|
||||
|
||||
$dis['type'] = $type;
|
||||
}
|
||||
|
||||
$price = $this->where($dis)->sum('apply_price');
|
||||
|
||||
return round($price,2);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-03-30 14:36
|
||||
* @功能说明:团长提现
|
||||
*/
|
||||
public function capCashCount($cap_id,$status=2){
|
||||
|
||||
$dis = [
|
||||
|
||||
|
||||
'cap_id' => $cap_id,
|
||||
|
||||
'status' => $status
|
||||
];
|
||||
|
||||
$count = $this->where($dis)->count();
|
||||
|
||||
return $count;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
512
app/massage/route/route.php
Normal file
512
app/massage/route/route.php
Normal file
@@ -0,0 +1,512 @@
|
||||
<?php
|
||||
|
||||
use think\facade\Route;
|
||||
|
||||
//商城后端路由表
|
||||
Route::group('admin', function () {
|
||||
//商品列表
|
||||
Route::post('Admin/login', 'Admin/login');
|
||||
//配置详情
|
||||
Route::post('AdminSetting/configInfo', 'AdminSetting/configInfo');
|
||||
//车费配置详情
|
||||
Route::get('AdminSetting/carConfigInfo', 'AdminSetting/carConfigInfo');
|
||||
//编辑车费配置
|
||||
Route::post('AdminSetting/carConfigUpdate', 'AdminSetting/carConfigUpdate');
|
||||
//配置修改
|
||||
Route::post('AdminSetting/configUpdate', 'AdminSetting/configUpdate');
|
||||
|
||||
Route::post('AdminSetting/payConfigInfo', 'AdminSetting/payConfigInfo');
|
||||
|
||||
Route::post('AdminSetting/payConfigUpdate', 'AdminSetting/payConfigUpdate');
|
||||
//banne列表
|
||||
Route::post('AdminSetting/bannerList', 'AdminSetting/bannerList');
|
||||
//banner添加
|
||||
Route::post('AdminSetting/bannerAdd', 'AdminSetting/bannerAdd');
|
||||
//banner编辑
|
||||
Route::post('AdminSetting/bannerUpdate', 'AdminSetting/bannerUpdate');
|
||||
//banner详情(id)
|
||||
Route::get('AdminSetting/bannerInfo', 'AdminSetting/bannerInfo');
|
||||
//修改密码(pass)
|
||||
Route::post('AdminSetting/updatePass', 'AdminSetting/updatePass');
|
||||
//评价标签列表
|
||||
Route::get('AdminSetting/lableList', 'AdminSetting/lableList');
|
||||
//评价标签详情
|
||||
Route::get('AdminSetting/lableInfo', 'AdminSetting/lableInfo');
|
||||
//添加评价标签
|
||||
Route::post('AdminSetting/lableAdd', 'AdminSetting/lableAdd');
|
||||
//编辑评价标签
|
||||
Route::post('AdminSetting/lableUpdate', 'AdminSetting/lableUpdate');
|
||||
//技师列表
|
||||
Route::get('AdminCoach/coachList', 'AdminCoach/coachList');
|
||||
//技师详情
|
||||
Route::get('AdminCoach/coachInfo', 'AdminCoach/coachInfo');
|
||||
//技师审核(status2通过,3拒绝,sh_text)
|
||||
Route::post('AdminCoach/coachUpdate', 'AdminCoach/coachUpdate');
|
||||
//技师等级列表
|
||||
Route::get('AdminCoach/levelList', 'AdminCoach/levelList');
|
||||
//添加技师等级
|
||||
Route::post('AdminCoach/levelAdd', 'AdminCoach/levelAdd');
|
||||
//编辑技师等级
|
||||
Route::post('AdminCoach/levelUpdate', 'AdminCoach/levelUpdate');
|
||||
//技师等级详情
|
||||
Route::get('AdminCoach/levelInfo', 'AdminCoach/levelInfo');
|
||||
//技师提现申请列表(type1是服务费提现,2是车费)
|
||||
Route::get('AdminCoach/walletList', 'AdminCoach/walletList');
|
||||
//提现详情
|
||||
Route::get('AdminCoach/walletInfo', 'AdminCoach/walletInfo');
|
||||
//通过提现(online:1线上,0线下)
|
||||
Route::post('AdminCoach/walletPass', 'AdminCoach/walletPass');
|
||||
//拒绝提现
|
||||
Route::post('AdminCoach/walletNoPass', 'AdminCoach/walletNoPass');
|
||||
//报警列表
|
||||
Route::get('AdminCoach/policeList', 'AdminCoach/policeList');
|
||||
//编辑报警
|
||||
Route::post('AdminCoach/policeUpdate', 'AdminCoach/policeUpdate');
|
||||
|
||||
|
||||
|
||||
//后台提现列表
|
||||
Route::get('AdminCoach/walletList', 'AdminCoach/walletList');
|
||||
//同意打款(id,status=2,online 1:线上,0线下)
|
||||
Route::post('AdminCoach/walletPass', 'AdminCoach/walletPass');
|
||||
//拒绝打款(id,status=3)
|
||||
Route::post('AdminCoach/walletNoPass', 'AdminCoach/walletNoPass');
|
||||
//财务管理
|
||||
Route::get('AdminCoach/financeList', 'AdminCoach/financeList');
|
||||
//商品列表
|
||||
Route::get('AdminGoods/goodsList', 'AdminGoods/goodsList');
|
||||
//审核商品数量
|
||||
Route::get('AdminGoods/goodsCount', 'AdminGoods/goodsCount');
|
||||
//审核详情
|
||||
Route::get('AdminGoods/shInfo', 'AdminGoods/shInfo');
|
||||
//审核商品详情
|
||||
Route::get('AdminGoods/shGoodsInfo', 'AdminGoods/shGoodsInfo');
|
||||
//同意|驳回申请 status 2 同意 3驳回
|
||||
Route::post('AdminGoods/shUpdate', 'AdminGoods/shUpdate');
|
||||
//用户列表
|
||||
Route::get('AdminUser/userList', 'AdminUser/userList');
|
||||
//退款列表
|
||||
Route::get('AdminOrder/refundOrderList', 'AdminOrder/refundOrderList');
|
||||
//订单列表
|
||||
Route::get('AdminOrder/orderList', 'AdminOrder/orderList');
|
||||
//订单详情
|
||||
Route::get('AdminOrder/orderInfo', 'AdminOrder/orderInfo');
|
||||
//退款详情
|
||||
Route::get('AdminOrder/refundOrderInfo', 'AdminOrder/refundOrderInfo');
|
||||
//后台打印订单(id,type 1赛车 2商城 3餐饮)
|
||||
Route::post('AdminOrder/orderPrinter', 'AdminOrder/orderPrinter');
|
||||
//拒绝退款
|
||||
Route::post('AdminOrder/noPassRefund', 'AdminOrder/noPassRefund');
|
||||
//同意退款
|
||||
Route::post('AdminOrder/passRefund', 'AdminOrder/passRefund');
|
||||
//订单评价列表
|
||||
Route::get('AdminOrder/commentList', 'AdminOrder/commentList');
|
||||
//编辑订单评价
|
||||
Route::post('AdminOrder/commentUpdate', 'AdminOrder/commentUpdate');
|
||||
//评价标签列表
|
||||
Route::get('AdminOrder/commentLableList', 'AdminOrder/commentLableList');
|
||||
//评价标签详情
|
||||
Route::get('AdminOrder/commentLableInfo', 'AdminOrder/commentLableInfo');
|
||||
//添加评价标签
|
||||
Route::post('AdminOrder/commentLableAdd', 'AdminOrder/commentLableAdd');
|
||||
//编辑评价标签
|
||||
Route::post('AdminOrder/commentLableUpdate', 'AdminOrder/commentLableUpdate');
|
||||
//提示列表(type,have_look,start_time,end_time)
|
||||
Route::get('AdminOrder/noticeList', 'AdminOrder/noticeList');
|
||||
//编辑提示()
|
||||
Route::post('AdminOrder/noticeUpdate', 'AdminOrder/noticeUpdate');
|
||||
//未查看的数量
|
||||
Route::post('AdminOrder/noLookCount', 'AdminOrder/noLookCount');
|
||||
//后台统计 date 交易情况时间 type 1 2 3订单流水 start_time end_time
|
||||
Route::post('AdminOrder/dataStatistics', 'AdminOrder/dataStatistics');
|
||||
//全部已读
|
||||
Route::post('AdminOrder/allLook', 'AdminOrder/allLook');
|
||||
//订单导出
|
||||
Route::get('AdminExcel/orderList', 'AdminExcel/orderList');
|
||||
//财务导出
|
||||
Route::get('AdminExcel/dateCount', 'AdminExcel/dateCount');
|
||||
//打印机详情(id)
|
||||
Route::get('AdminPrinter/printerInfo', 'AdminPrinter/printerInfo');
|
||||
//编辑打印机
|
||||
Route::post('AdminPrinter/printerUpdate', 'AdminPrinter/printerUpdate');
|
||||
//打印机列表
|
||||
Route::get('AdminPrinter/printerList', 'AdminPrinter/printerList');
|
||||
//打印机添加
|
||||
Route::post('AdminPrinter/printerAdd', 'AdminPrinter/printerAdd');
|
||||
//佣金记录
|
||||
Route::post('AdminUser/commList', 'AdminUser/commList');
|
||||
|
||||
Route::post('AdminUser/userUpdate', 'AdminUser/userUpdate');
|
||||
|
||||
Route::post('AdminUser/userIntegralUpdate', 'AdminUser/userIntegralUpdate');
|
||||
|
||||
|
||||
|
||||
/////////////////////
|
||||
//车手列表
|
||||
Route::get('AdminDriver/driverList', 'AdminDriver/driverList');
|
||||
//车手详情
|
||||
Route::get('AdminDriver/driverInfo', 'AdminDriver/driverInfo');
|
||||
//车手审核(2通过,3取消,4拒绝)
|
||||
Route::post('AdminDriver/driverUpdate', 'AdminDriver/driverUpdate');
|
||||
//奖杯列表
|
||||
Route::get('AdminDriver/trophyList', 'AdminDriver/trophyList');
|
||||
//添加奖杯
|
||||
Route::post('AdminDriver/trophyAdd', 'AdminDriver/trophyAdd');
|
||||
//编辑奖杯
|
||||
Route::post('AdminDriver/trophyUpdate', 'AdminDriver/trophyUpdate');
|
||||
//奖杯详情
|
||||
Route::get('AdminDriver/trophyInfo', 'AdminDriver/trophyInfo');
|
||||
|
||||
Route::get('AdminUser/userTrophy', 'AdminUser/userTrophy');
|
||||
//user_id trophy_id add
|
||||
Route::post('AdminUser/userTrophyAdd', 'AdminUser/userTrophyAdd');
|
||||
//奖杯下拉框
|
||||
Route::get('AdminDriver/trophySelect', 'AdminDriver/trophySelect');
|
||||
|
||||
//车型列表
|
||||
Route::get('AdminDriver/cartypeList', 'AdminDriver/cartypeList');
|
||||
//添加车型
|
||||
Route::post('AdminDriver/cartypeAdd', 'AdminDriver/cartypeAdd');
|
||||
//编辑车型
|
||||
Route::post('AdminDriver/cartypeUpdate', 'AdminDriver/cartypeUpdate');
|
||||
//车型详情
|
||||
Route::get('AdminDriver/cartypeInfo', 'AdminDriver/cartypeInfo');
|
||||
//车型下拉框
|
||||
Route::get('AdminDriver/cartypeSelect', 'AdminDriver/cartypeSelect');
|
||||
|
||||
|
||||
//产品列表(搜索:name)
|
||||
Route::get('AdminService/serviceList', 'AdminService/serviceList');
|
||||
//产品详情
|
||||
Route::get('AdminService/serviceInfo', 'AdminService/serviceInfo');
|
||||
//产品添加
|
||||
Route::post('AdminService/serviceAdd', 'AdminService/serviceAdd');
|
||||
//编辑产品|上下架删除
|
||||
Route::post('AdminService/serviceUpdate', 'AdminService/serviceUpdate');
|
||||
|
||||
|
||||
//优惠券列表(搜索:name)
|
||||
Route::get('AdminCoupon/couponList', 'AdminCoupon/couponList');
|
||||
//优惠券详情(id)
|
||||
Route::get('AdminCoupon/couponInfo', 'AdminCoupon/couponInfo');
|
||||
//添加优惠券
|
||||
Route::post('AdminCoupon/couponAdd', 'AdminCoupon/couponAdd');
|
||||
//编辑优惠券
|
||||
Route::post('AdminCoupon/couponUpdate', 'AdminCoupon/couponUpdate');
|
||||
//活动详情
|
||||
Route::get('AdminCoupon/couponAtvInfo', 'AdminCoupon/couponAtvInfo');
|
||||
//编辑活动
|
||||
Route::post('AdminCoupon/couponAtvUpdate', 'AdminCoupon/couponAtvUpdate');
|
||||
//后台派发卡券(coupon_id,user_id)
|
||||
Route::post('AdminCoupon/couponRecordAdd', 'AdminCoupon/couponRecordAdd');
|
||||
|
||||
|
||||
|
||||
|
||||
//储值充值卡列表
|
||||
Route::get('AdminBalance/cardList', 'AdminBalance/cardList');
|
||||
//储值充值卡列表
|
||||
Route::post('AdminBalance/cardAdd', 'AdminBalance/cardAdd');
|
||||
//编辑充值卡
|
||||
Route::post('AdminBalance/cardUpdate', 'AdminBalance/cardUpdate');
|
||||
//充值卡详情
|
||||
Route::get('AdminBalance/cardInfo', 'AdminBalance/cardInfo');
|
||||
//储值订单列表
|
||||
Route::get('AdminBalance/orderList', 'AdminBalance/orderList');
|
||||
//充值订单详情
|
||||
Route::get('AdminBalance/orderInfo', 'AdminBalance/orderInfo');
|
||||
|
||||
Route::get('AdminBalance/orderInfo', 'AdminBalance/orderInfo');
|
||||
|
||||
|
||||
//文章列表(title)
|
||||
Route::get('AdminSetting/articleList', 'AdminSetting/articleList');
|
||||
//添加文章
|
||||
Route::post('AdminSetting/articleAdd', 'AdminSetting/articleAdd');
|
||||
//编辑文章
|
||||
Route::post('AdminSetting/articleUpdate', 'AdminSetting/articleUpdate');
|
||||
//文章详情(id)
|
||||
Route::get('AdminSetting/articleInfo', 'AdminSetting/articleInfo');
|
||||
//文章下拉框
|
||||
Route::get('AdminSetting/articleSelect', 'AdminSetting/articleSelect');
|
||||
|
||||
|
||||
//活动内容列表
|
||||
Route::get('AdminAtv/contentList', 'AdminAtv/contentList');
|
||||
//活动内容下拉框
|
||||
Route::get('AdminAtv/contentSelect', 'AdminAtv/contentSelect');
|
||||
//活动内容详情
|
||||
Route::get('AdminAtv/contentInfo', 'AdminAtv/contentInfo');
|
||||
//活动内容添加
|
||||
Route::post('AdminAtv/contentAdd', 'AdminAtv/contentAdd');
|
||||
//活动内容编辑
|
||||
Route::post('AdminAtv/contentUpdate', 'AdminAtv/contentUpdate');
|
||||
//活动列表
|
||||
Route::get('AdminAtv/atvList', 'AdminAtv/atvList');
|
||||
//活动详情
|
||||
Route::get('AdminAtv/atvInfo', 'AdminAtv/atvInfo');
|
||||
//添加活动
|
||||
Route::post('AdminAtv/atvAdd', 'AdminAtv/atvAdd');
|
||||
//编辑活动
|
||||
Route::post('AdminAtv/atvUpdate', 'AdminAtv/atvUpdate');
|
||||
//活动列表
|
||||
Route::get('AdminAtv/recordList', 'AdminAtv/recordList');
|
||||
//活动详情
|
||||
Route::get('AdminAtv/recordInfo', 'AdminAtv/recordInfo');
|
||||
|
||||
Route::post('AdminAtv/recordUpdate', 'AdminAtv/recordUpdate');
|
||||
//比赛情况列表(name,major 1普通,2专业)
|
||||
Route::get('AdminAtv/gameList', 'AdminAtv/gameList');
|
||||
|
||||
Route::any('Tcp/test', 'Tcp/test');
|
||||
|
||||
Route::get('Tcp/test1', 'Tcp/test1');
|
||||
|
||||
Route::any('Tcp/getInfo', 'Tcp/getInfo');
|
||||
|
||||
Route::any('Tcp/gameList', 'Tcp/gameList');
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
//商城后端路由表
|
||||
Route::group('app', function () {
|
||||
//首页
|
||||
Route::get('Index/index', 'Index/index');
|
||||
//比赛成绩排行版 type 1普通组 2专业组
|
||||
Route::get('Index/resultTopList', 'Index/resultTopList');
|
||||
//赛事积分排行版(atv_id)
|
||||
Route::get('Index/integralRecordList', 'Index/integralRecordList');
|
||||
|
||||
Route::get('Index/successAtvList', 'Index/successAtvList');
|
||||
|
||||
Route::get('Index/atvInfo', 'Index/atvInfo');
|
||||
|
||||
Route::post('Index/appAtv', 'Index/appAtv');
|
||||
|
||||
Route::get('Index/coachInfo', 'Index/coachInfo');
|
||||
|
||||
Route::get('Index/articleList', 'Index/articleList');
|
||||
|
||||
Route::get('Index/articleInfo', 'Index/articleInfo');
|
||||
//再来一单(order_id)
|
||||
Route::post('Index/onceMoreOrder', 'Index/onceMoreOrder');
|
||||
//评价列表(coach_id)
|
||||
Route::get('Index/commentList', 'Index/commentList');
|
||||
//服务列表(sort:price 价格排序 ,total_sale销量排序 star评价排序 ,)
|
||||
Route::get('Index/serviceList', 'Index/serviceList');
|
||||
//服务详情(id)
|
||||
Route::get('Index/serviceInfo', 'Index/serviceInfo');
|
||||
//服务技师列表(ser_id,服务id,lat,lng)
|
||||
Route::get('Index/serviceCoachList', 'Index/serviceCoachList');
|
||||
//技师服务列表(coach_id)
|
||||
Route::get('Index/coachServiceList', 'Index/coachServiceList');
|
||||
//报名记录重新支付 record_id
|
||||
Route::post('Index/atvRecordRePay', 'Index/atvRecordRePay');
|
||||
//取消预约(record_id)
|
||||
Route::post('IndexUser/cancelAtvRecord', 'IndexUser/cancelAtvRecord');
|
||||
//活动预约二维码
|
||||
Route::post('IndexUser/atvRecordQr', 'IndexUser/atvRecordQr');
|
||||
//核销报名(record_id,card_id)
|
||||
Route::post('IndexUser/hxAtvRecord', 'IndexUser/hxAtvRecord');
|
||||
|
||||
Route::post('IndexUser/applyReseller', 'IndexUser/applyReseller');
|
||||
|
||||
|
||||
|
||||
|
||||
//用户授权
|
||||
Route::post('IndexUser/userUpdate', 'IndexUser/userUpdate');
|
||||
//phone
|
||||
Route::get('IndexUser/popalMemberByPhone', 'IndexUser/popalMemberByPhone');
|
||||
//绑定会员uid
|
||||
Route::post('IndexUser/bindMember', 'IndexUser/bindMember');
|
||||
//同步积分余额
|
||||
Route::post('IndexUser/synMemberCash', 'IndexUser/synMemberCash');
|
||||
//申请技师
|
||||
Route::post('IndexUser/coachApply', 'IndexUser/coachApply');
|
||||
//教练收藏列表
|
||||
Route::get('IndexUser/coachCollectList', 'IndexUser/coachCollectList');
|
||||
//添加技师收藏(coach_id)
|
||||
Route::post('IndexUser/addCollect', 'IndexUser/addCollect');
|
||||
//删除技师收藏(coach_id)
|
||||
Route::post('IndexUser/delCollect', 'IndexUser/delCollect');
|
||||
|
||||
Route::get('IndexUser/userInfo', 'IndexUser/userInfo');
|
||||
|
||||
Route::post('IndexUser/reportPhone', 'IndexUser/reportPhone');
|
||||
//优惠券活动详情
|
||||
Route::post('IndexUser/couponAtvInfo', 'IndexUser/couponAtvInfo');
|
||||
//用户|团长个人中心
|
||||
Route::get('IndexUser/index', 'IndexUser/index');
|
||||
//个人团长信息
|
||||
Route::get('IndexUser/coachInfo', 'IndexUser/coachInfo');
|
||||
//用户地址列表
|
||||
Route::get('IndexUser/addressList', 'IndexUser/addressList');
|
||||
//地址详情
|
||||
Route::get('IndexUser/addressInfo', 'IndexUser/addressInfo');
|
||||
//添加地址
|
||||
Route::post('IndexUser/addressAdd', 'IndexUser/addressAdd');
|
||||
//编辑地址
|
||||
Route::post('IndexUser/addressUpdate', 'IndexUser/addressUpdate');
|
||||
//删除地址
|
||||
Route::post('IndexUser/addressDel', 'IndexUser/addressDel');
|
||||
//获取默认地址
|
||||
Route::get('IndexUser/getDefultAddress', 'IndexUser/getDefultAddress');
|
||||
//活动二维码
|
||||
Route::post('IndexUser/atvQr', 'IndexUser/atvQr');
|
||||
//用户优惠券列表(status1,2,3)
|
||||
Route::get('IndexUser/userCouponList', 'IndexUser/userCouponList');
|
||||
//删除优惠券(coupon_id)
|
||||
Route::post('IndexUser/couponDel', 'IndexUser/couponDel');
|
||||
//获取配置信息
|
||||
Route::get('Index/configInfo', 'Index/configInfo');
|
||||
//技师首页
|
||||
Route::get('IndexCoach/coachIndex', 'IndexCoach/coachIndex');
|
||||
//技师编辑
|
||||
Route::post('IndexCoach/coachUpdate', 'IndexCoach/coachUpdate');
|
||||
//团长核销订单(id)
|
||||
Route::post('IndexCoach/hxOrder', 'IndexCoach/hxOrder');
|
||||
//订单列表
|
||||
Route::get('IndexCoach/orderList', 'IndexCoach/orderList');
|
||||
//团长佣金信息
|
||||
Route::get('IndexCoach/capCashInfo', 'IndexCoach/capCashInfo');
|
||||
//团长佣金信息(车费)
|
||||
Route::get('IndexCoach/capCashInfoCar', 'IndexCoach/capCashInfoCar');
|
||||
//提现记录
|
||||
Route::get('IndexCoach/capCashList', 'IndexCoach/capCashList');
|
||||
//申请提现(apply_price,text,type:1服务费提现,2车费提现)
|
||||
Route::post('IndexCoach/applyWallet', 'IndexCoach/applyWallet');
|
||||
//报警
|
||||
|
||||
Route::post('IndexCoach/police', 'IndexCoach/police');
|
||||
//技师修改订单信息(type,order_id)
|
||||
Route::post('IndexCoach/updateOrder', 'IndexCoach/updateOrder');
|
||||
|
||||
|
||||
|
||||
|
||||
Route::get('IndexGoods/indexCapList', 'IndexGoods/indexCapList');
|
||||
//选择楼长(cap_id)
|
||||
Route::post('IndexGoods/selectCap', 'IndexGoods/selectCap');
|
||||
//分类列表
|
||||
Route::get('IndexGoods/cateList', 'IndexGoods/cateList');
|
||||
//商品首页信息
|
||||
Route::get('IndexGoods/index', 'IndexGoods/index');
|
||||
|
||||
//商品列表
|
||||
Route::get('IndexGoods/goodsList', 'IndexGoods/goodsList');
|
||||
//商品详情
|
||||
Route::get('IndexGoods/goodsInfo', 'IndexGoods/goodsInfo');
|
||||
|
||||
//购物车信息(coach_id)
|
||||
Route::get('Index/carInfo', 'Index/carInfo');
|
||||
//添加购物车(service_id,coach_id,num = 1)
|
||||
Route::post('Index/addCar', 'Index/addCar');
|
||||
//删除购物车|减少购物车商品数量(id,num=1)
|
||||
Route::post('Index/delCar', 'Index/delCar');
|
||||
//批量删除购物车(coach)
|
||||
Route::post('Index/delSomeCar', 'Index/delSomeCar');
|
||||
//修改购物车(ID :arr)
|
||||
Route::post('Index/carUpdate', 'Index/carUpdate');
|
||||
//
|
||||
Route::post('IndexOrder/payOrder', 'IndexOrder/payOrder');
|
||||
//下单的那个页面(coach_id,有优惠券就传 coupon_id)
|
||||
Route::get('IndexOrder/payOrderInfo', 'IndexOrder/payOrderInfo');
|
||||
//用户订单列表(pay_type,name)
|
||||
Route::get('IndexOrder/orderList', 'IndexOrder/orderList');
|
||||
|
||||
Route::post('IndexOrder/delOrder', 'IndexOrder/delOrder');
|
||||
//订单详情
|
||||
Route::get('IndexOrder/orderInfo', 'IndexOrder/orderInfo');
|
||||
//重新支付
|
||||
Route::post('IndexOrder/rePayOrder', 'IndexOrder/rePayOrder');
|
||||
//取消订单
|
||||
Route::post('IndexOrder/cancelOrder', 'IndexOrder/cancelOrder');
|
||||
//申请退款(order_id,list:['id','num'])
|
||||
Route::post('IndexOrder/applyOrder', 'IndexOrder/applyOrder');
|
||||
//取消退款
|
||||
Route::post('IndexOrder/cancelRefundOrder', 'IndexOrder/cancelRefundOrder');
|
||||
//用户端退款列表(name,status)
|
||||
Route::get('IndexOrder/refundOrderList', 'IndexOrder/refundOrderList');
|
||||
//退款详情
|
||||
Route::get('IndexOrder/refundOrderInfo', 'IndexOrder/refundOrderInfo');
|
||||
//刷新订单二维码(id)
|
||||
Route::post('IndexOrder/refreshQr', 'IndexOrder/refreshQr');
|
||||
//选中时间(coach_id,day)
|
||||
Route::get('IndexOrder/timeText', 'IndexOrder/timeText');
|
||||
|
||||
Route::get('IndexOrder/dayText', 'IndexOrder/dayText');
|
||||
//添加评价(order_id,text,star)
|
||||
Route::post('IndexOrder/addComment', 'IndexOrder/addComment');
|
||||
|
||||
Route::get('IndexOrder/lableList', 'IndexOrder/lableList');
|
||||
//可用的优惠券(coach_id)
|
||||
Route::get('IndexOrder/couponList', 'IndexOrder/couponList');
|
||||
//
|
||||
Route::post('IndexOrder/hxOrder', 'IndexOrder/hxOrder');
|
||||
|
||||
//储值充值卡列表
|
||||
Route::get('IndexBalance/cardList', 'IndexBalance/cardList');
|
||||
//充值余额(card_id)
|
||||
Route::post('IndexBalance/payBalanceOrder', 'IndexBalance/payBalanceOrder');
|
||||
//充值订单列表(时间筛选 start_time,end_time)
|
||||
Route::get('IndexBalance/balaceOrder', 'IndexBalance/balaceOrder');
|
||||
//消费明细
|
||||
Route::get('IndexBalance/payWater', 'IndexBalance/payWater');
|
||||
//佣金列表 status 0,1,2
|
||||
Route::get('IndexUser/commList', 'IndexUser/commList');
|
||||
|
||||
Route::post('IndexUser/carApply', 'IndexUser/carApply');
|
||||
|
||||
Route::get('IndexUser/carInfo', 'IndexUser/carInfo');
|
||||
//报名列表
|
||||
Route::get('IndexUser/userAtvRecord', 'IndexUser/userAtvRecord');
|
||||
//报名情况详情(id)
|
||||
Route::get('IndexUser/recordInfo', 'IndexUser/recordInfo');
|
||||
//查询有成绩对日期
|
||||
Route::get('IndexUser/resultDate', 'IndexUser/resultDate');
|
||||
//根据日期获取比赛车型(day)
|
||||
Route::get('IndexUser/resultCarType', 'IndexUser/resultCarType');
|
||||
//个人成绩 (car_type_id ,day)
|
||||
Route::get('IndexUser/userResult', 'IndexUser/userResult');
|
||||
//我的排队信息
|
||||
Route::get('IndexUser/myLineUp', 'IndexUser/myLineUp');
|
||||
//签到 (type 1 订单 2报名,order_id 订单id 或者报名id)
|
||||
Route::post('IndexUser/signUp', 'IndexUser/signUp');
|
||||
//取消签到 (type 1 订单 2报名,order_id 订单id 或者报名id)
|
||||
Route::post('IndexUser/cancelSignUp', 'IndexUser/cancelSignUp');
|
||||
//id
|
||||
Route::post('IndexUser/payCancelRecord', 'IndexUser/payCancelRecord');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
//支付
|
||||
Route::any('IndexWxPay/returnPay', 'IndexWxPay/returnPay');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user