wesmiler 2 месяцев назад
Родитель
Сommit
fde9e0c96a

+ 34 - 0
app/Models/AccountStatisticsModel.php

@@ -0,0 +1,34 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Models;
+
+/**
+ * 用户收益账户-模型
+ * @author laravel开发员
+ * @since 2020/11/11
+ * @package App\Models
+ */
+class AccountStatisticsModel extends BaseModel
+{
+    // 设置数据表
+    protected $table = 'account_statistics';
+
+    /**
+     * 用户
+     * @return \Illuminate\Database\Eloquent\Relations\HasOne
+     */
+    public function member()
+    {
+        return $this->hasOne(MemberModel::class, 'id','user_id')
+            ->select(['id','mobile','nickname','balance','status']);
+    }
+}

+ 44 - 0
app/Models/MeetingModel.php

@@ -0,0 +1,44 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Models;
+
+/**
+ * 会议-模型
+ * @author laravel开发员
+ * @since 2020/11/11
+ * @package App\Models
+ */
+class MeetingModel extends BaseModel
+{
+    // 设置数据表
+    protected $table = 'meetings';
+
+    /**
+     * 推荐组织人
+     */
+    public function member()
+    {
+        return $this->hasOne(MemberModel::class, 'id','user_id')
+            ->where(['mark'=>1])
+            ->select(['id', 'nickname','avatar', 'username', 'mobile', 'status']);
+    }
+
+    /**
+     * 签到记录
+     * @return \Illuminate\Database\Eloquent\Relations\HasMany
+     */
+    public function records()
+    {
+        return $this->hasMany(MeetingRecordsModel::class, 'meeting_id','id')
+            ->where(['mark'=>1]);
+    }
+}

+ 45 - 0
app/Models/MeetingRecordsModel.php

@@ -0,0 +1,45 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Models;
+
+/**
+ * 会议签到记录-模型
+ * @author laravel开发员
+ * @since 2020/11/11
+ * @package App\Models
+ */
+class MeetingRecordsModel extends BaseModel
+{
+    // 设置数据表
+    protected $table = 'meetings_records';
+
+    /**
+     * 推荐组织人
+     */
+    public function member()
+    {
+        return $this->hasOne(MemberModel::class, 'id','user_id')
+            ->where(['mark'=>1])
+            ->select(['id', 'nickname','avatar', 'username', 'mobile', 'status']);
+    }
+
+    /**
+     * 会议
+     */
+    public function meeting()
+    {
+        return $this->hasOne(MeetingModel::class, 'id','meeting_id')
+            ->where(['mark'=>1])
+            ->select(['id', 'title','thumb', 'company', 'status']);
+    }
+    
+}

+ 3 - 14
app/Models/MemberModel.php

@@ -24,23 +24,12 @@ class MemberModel extends BaseModel
     protected $table = 'member';
 
     /**
-     * 代理信息
+     * 收益账户
      * @return \Illuminate\Database\Eloquent\Relations\hasOne
      */
-    public function agent()
+    public function account()
     {
-        return $this->hasOne(AgentModel::class, 'user_id','id')
-            ->where(['mark'=>1]);
-    }
-
-    /**
-     * 商家信息
-     * @return \Illuminate\Database\Eloquent\Relations\hasOne
-     */
-    public function store()
-    {
-        return $this->hasOne(StoreModel::class, 'user_id','id')
-            ->where(['mark'=>1]);
+        return $this->hasOne(AccountStatisticsModel::class, 'user_id','id');
     }
 
     /**

+ 6 - 3
app/Services/Api/MemberService.php

@@ -11,16 +11,14 @@
 
 namespace App\Services\Api;
 
+use App\Models\AccountStatisticsModel;
 use App\Models\ActionLogModel;
-use App\Models\BalanceLogModel;
 use App\Models\MemberBankModel;
 use App\Models\MemberModel;
-use App\Models\OrderModel;
 use App\Services\BaseService;
 use App\Services\JwtService;
 use App\Services\MpService;
 use App\Services\RedisService;
-use App\Services\SmsService;
 use Illuminate\Support\Facades\DB;
 use phpQrcode\QRcode;
 
@@ -169,6 +167,11 @@ class MemberService extends BaseService
             RedisService::set("caches:members:login_{$userId}", $updateData, rand(30, 60));
         }
 
+        // 如果未生成佣金账户则创建
+        if(!$accountId = AccountStatisticsModel::where(['user_id'])->value('id')){
+            AccountStatisticsModel::insert(['user_id'=>$userId]);
+        }
+
         // 获取登录授权token
         $token = JwtService::make()->encode($userId);
 

+ 4 - 0
app/Services/MpService.php

@@ -33,6 +33,10 @@ class MpService extends BaseService
         'getUserInfo'=>'https://api.weixin.qq.com/sns/jscode2session',
         // 获取手机号
         'getPhoneNumber'=>'https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=%s',
+        // 获取快递公司列表
+        'getDelivery'=>'https://api.weixin.qq.com/product/delivery/get_company_list?access_token=%s',
+        // 同步发货状态
+        'deliverySend'=>'https://api.weixin.qq.com/product/delivery/send?access_token=%s',
     ];