hrjy 3 سال پیش
والد
کامیت
c0f84c2783

+ 1 - 1
.env

@@ -1 +1 @@
-APP_DEBUG = true

[APP]
DEFAULT_TIMEZONE = Asia/Shanghai

[DATABASE]
TYPE = mysql
HOSTNAME = 127.0.0.1
HOSTPORT = 3306
USERNAME = root
PASSWORD = 'root'
DATABASE = crmebr
PREFIX = eb_
CHARSET = utf8
DEBUG = true

[LANG]
default_lang = zh-cn
+APP_DEBUG = true

[APP]
DEFAULT_TIMEZONE = Asia/Shanghai

[DATABASE]
TYPE = mysql
HOSTNAME = 127.0.0.1
HOSTPORT = 3306
USERNAME = root
PASSWORD = 'root'
DATABASE = qudou
PREFIX = eb_
CHARSET = utf8
DEBUG = true

[LANG]
default_lang = zh-cn

+ 2 - 0
app/admin/controller/setting/SystemAdmin.php

@@ -55,6 +55,8 @@ class SystemAdmin extends AuthController
             }
             return $options;
         })->multiple(1);
+        $f[] = Form::selectOne('uid', '绑定会员', $admin->uid)
+            ->options(User::field('uid as value,nickname as label')->select()->toArray());
         $f[] = Form::radio('status', '状态', 1)->options([['label' => '开启', 'value' => 1], ['label' => '关闭', 'value' => 0]]);
         $form = Form::make_post_form('添加管理员', $f, Url::buildUrl('save'));
         $this->assign(compact('form'));

+ 3 - 3
app/admin/controller/user/User.php

@@ -119,7 +119,7 @@ class User extends AuthController
         $f[] = Form::number('money', '余额')->min(0);
         $f[] = Form::radio('integration_status', '修改趣豆', 1)->options([['value' => 1, 'label' => '增加'], ['value' => 2, 'label' => '减少']]);
         $f[] = Form::number('integration', '趣豆')->min(0);
-        $f[] = Form::radio('anticipate_status', '修改预约卷', 1)->options([['value' => 1, 'label' => '增加'], ['value' => 2, 'label' => '减少']]);
+        $f[] = Form::radio('anticipate_status', '修改艺金券', 1)->options([['value' => 1, 'label' => '增加'], ['value' => 2, 'label' => '减少']]);
         $f[] = Form::number('anticipate', '预约券')->min(0);
         $form = Form::make_post_form('修改其他', $f, Url::buildUrl('update_other', array('uid' => $uid)));
         $this->assign(compact('form'));
@@ -192,7 +192,7 @@ class User extends AuthController
         if ($data['anticipate_status'] && $data['anticipate']) {//趣豆增加或者减少
             if ($data['anticipate_status'] == 1) {//增加
                 $edit['anticipate'] = bcadd($user['anticipate'], $data['anticipate'], 2);
-                $res3 = UserBillAdmin::income('系统增加预约券', $user['uid'], 'anticipate', 'add_anticipate', $data['anticipate'], $this->adminId, $edit['anticipate'], '系统增加了' . floatval($data['anticipate']) . '预约券');
+                $res3 = UserBillAdmin::income('系统增加艺金券', $user['uid'], 'anticipate', 'add_anticipate', $data['anticipate'], $this->adminId, $edit['anticipate'], '系统增加了' . floatval($data['anticipate']) . '预约券');
                 try {
                     UserRepository::adminAddIntegral($user, $data['integration']);
                 } catch (\Exception $e) {
@@ -201,7 +201,7 @@ class User extends AuthController
                 }
             } else if ($data['anticipate_status'] == 2) {//减少
                 $edit['anticipate'] = bcsub($user['anticipate'], $data['anticipate'], 2);
-                $res3 = UserBillAdmin::expend('系统减少预约券', $user['uid'], 'anticipate', 'reduce_anticipate', $data['anticipate'], $this->adminId, $edit['anticipate'], '系统扣除了' . floatval($data['anticipate']) . '预约券');
+                $res3 = UserBillAdmin::expend('系统减少艺金券', $user['uid'], 'anticipate', 'reduce_anticipate', $data['anticipate'], $this->adminId, $edit['anticipate'], '系统扣除了' . floatval($data['anticipate']) . '预约券');
                 try {
                     UserRepository::adminSubIntegral($user, $data['anticipate']);
                 } catch (\Exception $e) {

+ 1 - 0
app/admin/model/user/UserRecharge.php

@@ -95,6 +95,7 @@ class UserRecharge extends BaseModel
             $item['_pay_time'] = $item['pay_time'] ? date('Y-m-d H:i:s', $item['pay_time']) : '暂无';
             $item['_add_time'] = $item['add_time'] ? date('Y-m-d H:i:s', $item['add_time']) : '暂无';
             $item['paid_type'] = $item['paid'] ? '已支付' : '未支付';
+            $item['type'] = $item['type'] == 1? '余额充值' : '艺金券充值';
         }
         $count = self::setWhere($where, null, 'a', 'u.nickname')->join('user u', 'u.uid=a.uid')->count();
         return compact('data', 'count');

+ 1 - 0
app/admin/view/finance/user_recharge/index.php

@@ -108,6 +108,7 @@
             {field: 'price', title: '支付金额',sort:true},
             {field: 'paid_type', title: '是否支付'},
             {field: '_recharge_type', title: '充值类型'},
+            {field: 'type', title: '类型'},
             {field: '_pay_time', title: '支付时间'},
             {field: 'right', title: '操作',toolbar:'#act',width:'5%'},
         ];

+ 1 - 1
app/api/controller/auction/AuctionController.php

@@ -83,7 +83,7 @@ class AuctionController
 
         if ($res){
             AuctionBooking::booking($user['uid'], $auction);
-            UserBill::expend('预约场馆', $user['uid'], 'anticipate','reduce_anticipate', $auction['anticipate'], 0, $user['anticipate'], '预约扣除预约卷'); // 写入记录
+            UserBill::expend('预约场馆', $user['uid'], 'anticipate','reduce_anticipate', $auction['anticipate'], 0, $user['anticipate'], '预约扣除艺金券'); // 写入记录
 
             User::commitTrans();
             return app('json')->successful('预约成功');

+ 54 - 0
app/api/controller/user/UserBillController.php

@@ -279,6 +279,60 @@ class UserBillController
                 } else $urlCode = $imageInfo['att_dir'];
                 if ($imageInfo['image_type'] == 1) $urlCode = $siteUrl . $urlCode;
                 $siteUrl = set_http_type($siteUrl, 1);
+                $filelink = [
+                    'Bold' => 'static' . DS . 'font' . DS . 'Alibaba-PuHuiTi-Regular.otf',
+                    'Normal' => 'static' . DS . 'font' . DS . 'Alibaba-PuHuiTi-Regular.otf',
+                ];
+                if (!file_exists($filelink['Bold'])) return app('json')->fail('缺少字体文件Bold');
+                if (!file_exists($filelink['Normal'])) return app('json')->fail('缺少字体文件Normal');
+                foreach ($routineSpreadBanner as $key => &$item) {
+                    $posterInfo = '海报生成失败:(';
+                    $config = array(
+                        'image' => array(
+                            array(
+                                'url' => $urlCode,     //二维码资源
+                                'stream' => 0,
+                                'left' => 225,
+                                'top' => 913,
+                                'right' => 0,
+                                'bottom' => 0,
+                                'width' => 300,
+                                'height' => 300,
+                                'opacity' => 100
+                            )
+                        ),
+                        'text' => array(
+                            array(
+                                'text' => $user['nickname'],
+                                'left' => 250,
+                                'top' => 840,
+                                'fontPath' => $rootPath . 'public' . DS . $filelink['Bold'],     //字体文件
+                                'fontSize' => 16,             //字号
+                                'fontColor' => '40,40,40',       //字体颜色
+                                'angle' => 0,
+                            ),
+                            array(
+                                'text' => '邀请您加入' . sys_config('site_name'),
+                                'left' => 250,
+                                'top' => 880,
+                                'fontPath' => $rootPath . 'public' . DS . $filelink['Normal'],     //字体文件
+                                'fontSize' => 16,             //字号
+                                'fontColor' => '40,40,40',       //字体颜色
+                                'angle' => 0,
+                            )
+                        ),
+                        'background' => $item['pic']
+                    );
+                    $resWap = $resWap && $posterInfo = UtilService::setSharePoster($config, 'wap/spread/poster');
+                    if (!is_array($posterInfo)) return app('json')->fail($posterInfo);
+                    SystemAttachment::attachmentAdd($posterInfo['name'], $posterInfo['size'], $posterInfo['type'], $posterInfo['dir'], $posterInfo['thumb_path'], 1, $posterInfo['image_type'], $posterInfo['time'], 2);
+                    if ($resWap) {
+                        if ($posterInfo['image_type'] == 1)
+                            $item['wap_poster'] = $siteUrl . $posterInfo['thumb_path'];
+                        else
+                            $item['wap_poster'] = UtilService::setHttpType($posterInfo['thumb_path'], 1);
+                    }
+                }
             }
             if ($resRoutine && $resWap) return app('json')->successful($routineSpreadBanner);
             else return app('json')->fail('生成图片失败');

+ 7 - 2
app/api/controller/user/UserRechargeController.php

@@ -140,13 +140,18 @@ class UserRechargeController
                         $paid_price = $data['give_money'] ?? 0;
                     }
                 }
-                $rechargeOrder = UserRecharge::addyy($request->uid(), $price, 'routine', $paid_price);
+                $rechargeOrder = UserRecharge::addyy($request->uid(), $price, 'weixin', $paid_price);
                 if (!$rechargeOrder) return app('json')->fail('充值订单生成失败!');
                 try {
-                    return app('json')->successful(UserRecharge::jsPay($rechargeOrder));
+                    if ($from == 'weixinh5') {
+                        $recharge = UserRecharge::wxH5Pay($rechargeOrder);
+                    } else {
+                        $recharge = UserRecharge::wxPay($rechargeOrder);
+                    }
                 } catch (\Exception $e) {
                     return app('json')->fail($e->getMessage());
                 }
+                return app('json')->successful(['type' => $from, 'data' => $recharge]);
                 break;
             default:
                 return app('json')->fail('缺少参数');

+ 3 - 3
app/models/auction/AuctionOrder.php

@@ -270,7 +270,7 @@ class AuctionOrder extends BaseModel
                             $user = \app\models\user\User::where('uid', $v['collection_id'])->find();
                             $user['anticipate'] = $user['anticipate'] + $auction['anticipate']/2; // 卖家增加预约卷
                             $booking['deduction'] = $auction['anticipate']/2;
-                            UserBill::income('增加预约卷', $v['collection_id'], 'anticipate', 'add_anticipate',  $auction['anticipate']/2, $v['uid'], $user['anticipate'], '卖出订单未上传支付凭证,增加'.($auction['anticipate']/2).'预约卷');
+                            UserBill::income('增加艺金券', $v['collection_id'], 'anticipate', 'add_anticipate',  $auction['anticipate']/2, $v['uid'], $user['anticipate'], '卖出订单未上传支付凭证,增加'.($auction['anticipate']/2).'预约卷');
                             $booking->save();
                             $user->save();
                         }
@@ -280,7 +280,7 @@ class AuctionOrder extends BaseModel
                         $user = \app\models\user\User::where('uid', $v['collection_id'])->find();
                         $user['anticipate'] = $user['anticipate'] + ($auction['anticipate'] - $auction['deduction']); // 卖家增加预约卷
                         $booking['deduction'] = $auction['anticipate'];
-                        UserBill::income('增加预约卷', $v['collection_id'], 'anticipate', 'add_anticipate', $auction['anticipate'] - $auction['deduction'], $v['uid'], $user['anticipate'], '卖出订单未上传支付凭证,增加' . ($auction['anticipate'] - $auction['deduction']) . '预约卷');
+                        UserBill::income('增加艺金券', $v['collection_id'], 'anticipate', 'add_anticipate', $auction['anticipate'] - $auction['deduction'], $v['uid'], $user['anticipate'], '卖出订单未上传支付凭证,增加' . ($auction['anticipate'] - $auction['deduction']) . '预约卷');
                         $booking->save();
                         $user->save();
                         AuctionBooking::where('id', $booking['id'])->update(['status' => 2]); // 修改预约订单状态 为扣除
@@ -319,7 +319,7 @@ class AuctionOrder extends BaseModel
 
                             $user->save();
                             $find->save();
-                            UserBill::income('退回预约券',$user['uid'], 'anticipate', 'add_anticipate', $value['anticipate'], 0, $user['anticipate'], '预约卷'.$value['anticipate'].'退回');
+                            UserBill::income('退回艺金券',$user['uid'], 'anticipate', 'add_anticipate', $value['anticipate'], 0, $user['anticipate'], '预约卷'.$value['anticipate'].'退回');
                         }
                     }
                 }

+ 2 - 2
app/models/user/UserRecharge.php

@@ -142,8 +142,8 @@ class UserRecharge extends BaseModel
             self::beginTrans();
             $price = bcadd($order['price'], $order['give_price'], 2);
             $res1 = self::where('order_id', $order['order_id'])->update(['paid' => 1, 'pay_time' => time()]);
-            $mark = '成功充值预约券' . floatval($order['price']) . '元' . ($order['give_price'] ? ',赠送' . $order['give_price'] . '元' : '');
-            $res2 = UserBill::income('用户预约券充值', $order['uid'], 'integral', 'add_anticipate', $order['price'], $order['id'], $user['anticipate'], $mark);
+            $mark = '成功充值艺金券' . floatval($order['price']) . '元' . ($order['give_price'] ? ',赠送' . $order['give_price'] . '元' : '');
+            $res2 = UserBill::income('用户艺金券充值', $order['uid'], 'anticipate', 'recharge_anticipate', $order['price'], $order['id'], $user['anticipate'], $mark);
             $res3 = User::edit(['anticipate' => bcadd($user['anticipate'], $price, 2)], $order['uid'], 'uid');
             $res = $res1 && $res2 && $res3;
             self::checkTrans($res);