Browse Source

Merge branch 'master' of http://git.huxiukeji.com/zhangxiaobin/ggyuyin

lizhen_gitee 1 year ago
parent
commit
d5850ea151

+ 1 - 1
application/admin/view/party/party/edit.html

@@ -87,7 +87,7 @@
         </div>
     </div>
     <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('工会长抽成(%)')}:</label>
+        <label class="control-label col-xs-12 col-sm-2">{:__('长抽成(%)')}:</label>
         <div class="col-xs-12 col-sm-8">
             <input id="c-guilderRate" data-rule="required" class="form-control" name="row[guilderRate]" type="number" value="{$row.guilderRate|htmlentities}">
         </div>

+ 58 - 3
application/api/controller/Dispatch.php

@@ -3,6 +3,7 @@
 namespace app\api\controller;
 
 use app\common\controller\Api;
+use app\common\model\Message;
 use think\Db;
 use app\common\library\Sms as Smslib;
 /**
@@ -430,6 +431,7 @@ class Dispatch extends Common
             $data["createtime"] = time();
             $res = $orderModel->insertGetId($data);
             if($res) {
+                \app\common\model\Message::addMessage($authInfo["user_id"],"派单通知","您的技能:".$skillInfo["name"]."有人下单啦,请注意查看!");
                 Db::commit();
                 $this->success('订单创建成功!',["order_no"=>$out_trade_no]);
             } else {
@@ -554,7 +556,7 @@ class Dispatch extends Common
                 $reciveuserInfo = $userModel->where(["id"=>$orderInfo["recive_id"]])->find();
                 //Smslib::notice($reciveuserInfo->mobile, $orderInfo["skill_name"],"有人接单啦",'orderNotice');
                 // 系统消息通知
-                \app\common\model\Message::addMessage($orderInfo["recive_id"],"派单通知","您的派单,技能:".$orderInfo["skill_name"]."有人接单啦,请登录伴声app查看!");
+                \app\common\model\Message::addMessage($orderInfo["recive_id"],"派单通知","您的派单,技能:".$orderInfo["skill_name"]."有人接单啦,请注意查看!");
 
                 $this->success('支付成功!');
             } else {
@@ -639,7 +641,7 @@ class Dispatch extends Common
                     //$reciveuserInfo = $userModel->where(["id"=>$orderInfo["user_id"]])->find();
                     //Smslib::notice($reciveuserInfo->mobile, $orderInfo["skill_name"],"被拒绝接单",'orderNotice');
                     // 系统消息通知
-                    \app\common\model\Message::addMessage($orderInfo["user_id"],"派单通知","您的订单,技能:".$orderInfo["skill_name"]."已被拒绝接单,请登录伴声app查看!");
+                    \app\common\model\Message::addMessage($orderInfo["user_id"],"派单通知","您的订单,技能:".$orderInfo["skill_name"]."已被拒绝接单,请注意查看!");
 
                     $this->success('订单完成。');
                 } else {
@@ -702,7 +704,7 @@ class Dispatch extends Common
                     //Smslib::send($reciveuserInfo->mobile, $orderInfo["skill_name"], "顺利完成啦!",'orderNotice');
 
                     // 系统消息通知
-                    \app\common\model\Message::addMessage($orderInfo["recive_id"],"派单通知","您的派单,技能:".$orderInfo["skill_name"]." 完成啦!,请登录GG语音app查看!");
+                    \app\common\model\Message::addMessage($orderInfo["recive_id"],"派单通知","您的派单,技能:".$orderInfo["skill_name"]." 完成啦!,请注意查看!");
 
                     $this->success('恭喜!订单完成。');
                 } else {
@@ -718,6 +720,56 @@ class Dispatch extends Common
                 Db::rollback();
                 $this->error($e->getMessage());
             }
+        }if($status == -2) { // 取消订单
+            if($orderInfo["status"] != 1) {
+                $this->error(__('当前订单状态不支持拒绝订单!'),[],104);
+            }
+            // 完成订单操作需要更新余额记录
+            Db::startTrans();
+            try{
+                $userModel = new \app\common\model\User();
+                $money = $orderInfo["price"] * $orderInfo["num"];
+                // 解冻用户余额
+                $where = [];
+                $where["id"] = $this->auth->id;
+                $userInfo = $userModel->where($where)->find();
+                if($userInfo["frozen"] - $money < 0) {
+                    $this->error(__('账户资金异常,请联系管理员!'),[],105);
+                }
+                $res1 = $userModel->where($where)->setDec("frozen",$money);
+                $res2 = $userModel->where($where)->setInc("jewel",$money);
+                // 添加用户余额变动记录
+                $userjewellogModel = new \app\common\model\UserJewelLog();
+                $res3 = $userjewellogModel->addUserJewelLog($orderInfo["recive_id"], $money, "+", $userInfo["jewel"], "拒绝订单返还余额", 7);
+                // 更新订单状态
+                $data = [];
+                $data["status"] = $status;
+                $where = [];
+                $where["order_no"] = $order_no;
+                $res4 = $orderModel->update($data,$where);
+
+                if($res1 && $res2 && $res3 && $res4) {
+                    Db::commit();
+                    // 短信通知
+                    //$reciveuserInfo = $userModel->where(["id"=>$orderInfo["user_id"]])->find();
+                    //Smslib::notice($reciveuserInfo->mobile, $orderInfo["skill_name"],"被拒绝接单",'orderNotice');
+                    // 系统消息通知
+                    \app\common\model\Message::addMessage($orderInfo["recive_id"],"派单通知","您的订单,技能:".$orderInfo["skill_name"]."已被取消,请登录查看!");
+
+                    $this->success('订单取消成功。');
+                } else {
+                    $this->error(__('订单更新失败!请稍后重试'));
+                }
+            }catch (ValidateException $e) {
+                Db::rollback();
+                $this->error($e->getMessage());
+            } catch (PDOException $e) {
+                Db::rollback();
+                $this->error($e->getMessage());
+            } catch (Exception $e) {
+                Db::rollback();
+                $this->error($e->getMessage());
+            }
         } else {
             $data = [];
             $data["status"] = $status;
@@ -725,6 +777,9 @@ class Dispatch extends Common
             $where["order_no"] = $order_no;
             $res = $orderModel->update($data,$where);
             if($res) {
+                if ($status == 2) {//接单发
+                    \app\common\model\Message::addMessage($orderInfo['user_id'],"订单单通知","您的订单:".$order_no."已被接单,请登录查看!");
+                }
                 $this->success('更新成功!');
             } else {
                 $this->error(__('订单创建失败!'));

+ 2 - 2
application/api/controller/Index.php

@@ -240,7 +240,7 @@ class Index extends Api
         $where = [];
         $where["a.createtime"] = ["gt",$timeArr[$time]];
         $list = model('GiftUserParty')->alias("a")
-            ->field("sum(a.value) as total_price,u.avatar,u.nickname")
+            ->field("sum(a.value) as total_price,a.user_id,u.avatar,u.nickname")
             ->where($where)
             ->join("hx_user u","u.id = a.user_id")
             ->group("a.user_to_id")
@@ -290,7 +290,7 @@ class Index extends Api
         $where["a.type"] = ["in",[0,2,3,5,6,11,13]];//查看wallet.php文件
         $where["a.createtime"] = ["gt",$timeArr[$time]];
         $list = model('UserJewelLog')->alias("a")
-            ->field("sum(a.value) as total_price,u.avatar,u.nickname")
+            ->field("sum(a.value) as total_price,a.user_id,u.avatar,u.nickname")
             ->where($where)
             ->join("hx_user u","u.id = a.user_id")
             ->group("a.user_id")

+ 3 - 0
application/common/service/UserService.php

@@ -132,6 +132,9 @@ class UserService
             if (isset($resultData['code']) && !empty($resultData['code'])) {
                 throw new Exception($resultData['message']);
             }
+            if (isset($resultData['result']['res']) && $resultData['result']['res'] != 1) {
+                throw new Exception($resultData['result']['description']);
+            }
             $result['data'] = $resultData;
         } catch (Exception $e) {
             $result['status'] = 0;

+ 3 - 3
public/assets/js/backend/party/party.js

@@ -37,14 +37,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'party_logo', title: __('Party_logo'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false},
                         // {field: 'party_notice', title: __('Party_notice'), operate: 'LIKE'},
                         // {field: 'party_notice_detail', title: __('Party_notice_detail'), operate: 'LIKE'},
-                        {field: 'naming', title: __('Naming')},
+                        //{field: 'naming', title: __('Naming')},
                         // {field: 'is_online', title: __('Is_online'), searchList: {"1":__('Is_online 1'),"0":__('Is_online 0')}, formatter: Table.api.formatter.normal},
                         {field: 'status', title: __('Status'), searchList: {"-1":__('Status -1'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
                         {field: 'is_close', title: __('Is_close'), searchList: {"1":__('Is_close 1'),"0":__('Is_close 0')}, formatter: Table.api.formatter.normal},
                         {field: 'is_recommend', title: __('Is_recommend'), searchList: {"1":__('Is_recommend 1'),"0":__('Is_recommend 0')}, formatter: Table.api.formatter.normal},
-                        {field: 'party_type', title: __('Party_type')},
+                        //{field: 'party_type', title: __('Party_type')},
                         {field: 'platRate', title: __('平台抽成(%)')},
-                        {field: 'guilderRate', title: __('工会长抽成(%)')},
+                        {field: 'guilderRate', title: __('长抽成(%)')},
                         // {field: 'party_pass', title: __('Party_pass'), operate: 'LIKE'},
                         // {field: 'is_screen', title: __('Is_screen'), searchList: {"1":__('Is_screen 1'),"0":__('Is_screen 0')}, formatter: Table.api.formatter.normal},
                         {field: 'on_model', title: __('On_model'), searchList: {"1":__('On_model 1'),"2":__('On_model 2')}, formatter: Table.api.formatter.normal},