mark 2 жил өмнө
parent
commit
d55378b379

+ 16 - 11
app/Http/Controllers/BaseController.php

@@ -15,6 +15,7 @@ use App\Http\Bean\Util\Wechat\Miniprograme\GetProductListParamBean;
 use App\Http\Enum\MeiTuanLinkTypeEnum;
 use App\Http\Utils\BaseUtil;
 use App\Http\Utils\DianYing\DianYingUtil;
+use App\Http\Utils\HeiMaUtil;
 use App\Http\Utils\Jutuike\JutuikeUtil;
 use App\Http\Utils\KenDeJi\KenDeJiUtil;
 use App\Http\Utils\McDonalds\McDonaldsUtil;
@@ -130,19 +131,23 @@ class BaseController extends Controller
 
     public function test()
     {
-        $completeOrders = UserOrderCommissionModel::query()
-            ->where("commission_status",1)
-            ->where("order_commission",">",0)
-            ->where("user_id","<>",0)
-            ->where("order_complete_notify_status",0)
-            ->groupBy("user_id")
-            ->select(["user_id",DB::Raw("sum(order_commission) as total_order_commission"),DB::Raw("GROUP_CONCAT(id) as ids")])
-            ->get();
-        return $this->success($completeOrders);
+//        dd(TaobaoLianMengUtil::getGoodsInfo(621062906541));
+//        $completeOrders = UserOrderCommissionModel::query()
+//            ->where("commission_status",1)
+//            ->where("order_commission",">",0)
+//            ->where("user_id","<>",0)
+//            ->where("order_complete_notify_status",0)
+//            ->groupBy("user_id")
+//            ->select(["user_id",DB::Raw("sum(order_commission) as total_order_commission"),DB::Raw("GROUP_CONCAT(id) as ids")])
+//            ->get();
+//        return $this->success($completeOrders);
 //        return $this->success(JutuikeUtil::getActList());
 //        TaobaoLianMengUtil::taokoulingConvert("淘宝,信这于好之他而着我而天到微喜【sheii苏茵茵】大小姐~韩国真皮粗跟中筒靴女秋弹力长靴瘦腿靴");
-        TaobaoLianMengUtil::taokoulingConvert("89!就心也对他可大能们后小哈 https://m.tb.cn/h.fgXlN6a?sm=3efae5  儿童过家家小医生玩具套装仿真医疗箱女孩护士打针男孩听诊器工具");
-//        $data = JutuikeUtil::goodsCategory("jd");
+        $res = HeiMaUtil::gaoYongZhuanLian(621062906541);
+//        $res = TaobaoLianMengUtil::taokoulingConvert("49嘻学上时说他然上在家去了! https://m.tb.cn/h.fjEHoGt?sm=d75195  超大浴巾成人男女学生宿舍比纯棉全棉吸水速干洗澡可穿毛巾裹巾夏");
+
+        dd($res);
+        //        $data = JutuikeUtil::goodsCategory("jd");
 //        return $this->success($data);
 //        $url = "https://mobile.yangkeduo.com/goods.html?_wvx=10&refer_share_uin=RKJBZMVHVOZWU3HQPZYUD5MAEQ_GEXDA&refer_share_uid=5985443220&share_uin=RKJBZMVHVOZWU3HQPZYUD5MAEQ_GEXDA&page_from=23&_wv=41729&refer_share_id=vJXEDkANGEc4uvPW9QgRCHPj3P6GELOc&refer_share_channel=copy_link&share_uid=5985443220&pxq_secret_key=EUEHP3OMNH3X4GQUAL37HDD7UJBLLM3OD42X55VHLGG6GT3EBPLQ&goods_id=276748200008";
 //        $url = "https://mobile.yangkeduo.com/goods.html?_wvx=10&refer_share_uin=QKZTKYYF4LYNCB7SVBSL42IYWY_GEXDA&refer_share_uid=3669222324&share_uin=QKZTKYYF4LYNCB7SVBSL42IYWY_GEXDA&page_from=101&_wv=41729&refer_share_id=l6x0HEi8EMpQ2F9CJiCmsW1IqO5fnT3K&refer_share_channel=copy_link&share_uid=3669222324&pxq_secret_key=6T5MOY4WIDK2ALUXMKACS7QZ3CEYWBUQRZATVA5T5PDULJS3CV6A&goods_id=169921843493";

+ 31 - 0
app/Http/Controllers/User/UserController.php

@@ -328,4 +328,35 @@ class UserController extends BaseController
         $data = UserLogic::getRecommendUrlLogic();
         return $this->success($data);
     }
+
+    /**
+     * @SWG\Post(
+     *     path="/user/feedback",
+     *     tags={"用户管理"},
+     *     summary="反馈接口",
+     *     description="反馈接口",
+     *     produces={"application/json"},
+     *     @SWG\Parameter(
+     *          name="content",
+     *          in="query",
+     *          description="反馈内容",
+     *          type="string"
+     *     ),
+     *     @SWG\Response(
+     *         response="200",
+     *         description="success",
+     *          @SWG\Schema(ref="#/definitions/SuccessBean")
+     *     ),
+     *     @SWG\Response(
+     *         response="403",
+     *         description="fail",
+     *         @SWG\Schema(ref="#/definitions/ErrorBean")
+     *     )
+     * )
+     */
+    public function feedback()
+    {
+        UserLogic::feedbackLogic();
+        return $this->success();
+    }
 }

+ 24 - 0
app/Http/Logic/User/UserLogic.php

@@ -10,6 +10,7 @@ use App\Http\Logic\BaseLogic;
 use App\Http\Utils\BaseUtil;
 use App\Http\Utils\WechatAccountUtil;
 use App\Models\UserCashModel;
+use App\Models\UserFeadbackModel;
 use App\Models\UserFinanceModel;
 use App\Models\UserModel;
 use App\Models\UserOrderCommissionModel;
@@ -233,4 +234,27 @@ class UserLogic extends BaseLogic
         $app = WechatAccountUtil::getApp($params["code"]);
         return $app->qrcode->forever($userId);
     }
+
+    /**
+     * 反馈逻辑
+     */
+    public static function feedbackLogic()
+    {
+        $userId = BaseUtil::getUserId();
+        $params = request()->all();
+
+        $user = UserModel::findById($userId);
+
+        UserFeadbackModel::query()
+            ->insert(
+                [
+                    "user_id"=>$userId,
+                    "user_nick_name"=>$user["user_nickname"],
+                    "content"=>$params["content"],
+                    "created_at"=>date("Y-m-d H:i:s"),
+                    "updated_at"=>date("Y-m-d H:i:s"),
+                    "status"=>0
+                ]
+            );
+    }
 }

+ 14 - 0
app/Http/Logic/WechatLogic.php

@@ -278,6 +278,9 @@ S;
         //获取聚推客的推广位ID
         $jutuikeSid = BaseUtil::getPlatformUserSpreadId(PlatformTypeEnum::PLATFORM_JUTUIKE,$daogoUser->id);
 
+        //获取淘宝推广位ID
+        $taobaoSid = BaseUtil::getPlatformUserSpreadId(PlatformTypeEnum::PLATFORM_TAOBAO,$daogoUser->id);
+
         //判断是否是帮助
         if($message["Content"]=="帮助"){
             $msg1 = new Image(env("WECHAT_IMAGE_MEDIA_ID"));
@@ -290,6 +293,12 @@ S;
             $app->customer_service->message($wenti)->to($officialOpenId)->send();
             return;
         }
+        //判断是否余额
+        if($message["Content"]=="余额"){
+            $wenti = new Text("点击公众号菜单=>个人中心,可查看当月预估收益和上月收益");
+            $app->customer_service->message($wenti)->to($officialOpenId)->send();
+            return;
+        }
         $wenti = new Text("稍等");
         $app->customer_service->message($wenti)->to($officialOpenId)->send();
 
@@ -482,6 +491,11 @@ S;
                 $instance->info("匹配到淘宝链接");
                 $goodsInfo = TaobaoLianMengUtil::taokoulingConvert($message["Content"]);
                 $instance->info("淘宝返回数据:".json_encode($goodsInfo));
+
+                //获取商品详情
+//                $goodsItem = TaobaoLianMengUtil::getGoodsInfo($goodsInfo["num_iid"]);
+                //获取淘口令
+
                 $tuiguangRes = JutuikeUtil::convert($goodsInfo["num_iid"],$jutuikeSid);
                 $goodsTitle = $tuiguangRes["goodsName"];
                 $goodsPrice = $tuiguangRes["marketPrice"];

+ 11 - 1
app/Http/Utils/BaseUtil.php

@@ -9,6 +9,7 @@ use App\Http\Enum\ErrorEnum;
 use App\Http\Enum\PlatformTypeEnum;
 use App\Http\Utils\Pdd\DuoDuoKeUtil;
 use App\Models\PlatformSidModel;
+use App\Models\TaobaoPidModel;
 use App\Models\WebSiteModel;
 use App\Models\WechatAccountModel;
 use Illuminate\Support\Facades\DB;
@@ -151,7 +152,16 @@ class BaseUtil
             switch ($platformType){
                 case PlatformTypeEnum::PLATFORM_TAOBAO:
                     //淘宝
-
+                    DB::beginTransaction();
+                    $taobaoPid = TaobaoPidModel::query()->where("status",0)->lock(true)->first();
+                    if(!$taobaoPid){
+                        DB::rollBack();
+                        BaseUtil::sendBaoJing("","淘宝推广位不足","获取淘宝推广位");
+                        throw new CommonException(ErrorEnum::ERROR_SYSTEM);
+                    }
+                    TaobaoPidModel::query()->where("id",$taobaoPid["id"])->update(["status"=>1]);
+                    DB::commit();
+                    $sid = $taobaoPid["adzone_id"];
                     break;
                 case PlatformTypeEnum::PLATFORM_PINGDUODUO:
                     //拼多多

+ 58 - 0
app/Http/Utils/HeiMaUtil.php

@@ -3,8 +3,66 @@
 
 namespace App\Http\Utils;
 
+use App\Exceptions\CommonException;
+use App\Http\Enum\ErrorEnum;
+use Tool\ShanTaoTool\HttpCurl;
 
+/**
+ * 黑马淘客工具类
+ * Class HeiMaUtil
+ * @package App\Http\Utils
+ */
 class HeiMaUtil extends BaseUtil
 {
+    //基础链接
+    static $baseUrl = "https://www.heimataoke.com/";
 
+    /**
+     * 根据商品ID获取商品的佣金信息
+     * @param $goodsId
+     */
+    public static function gaoYongZhuanLian($goodsId)
+    {
+        $url = self::$baseUrl."api-zhuanlian";
+        $params = [
+            "appkey"=>"611653348",
+            "appsecret"=>"4f660e85e93bc45012591d0a314997d6",
+            "sid"=>"4463",
+            "pid"=>"mm_101807570_250550471_102348550452",
+//            "pid"=>"mm_34231311_452000065_108585250029",
+            "num_iid"=>$goodsId,
+            "signurl"=>1
+        ];
+
+        $res = HttpCurl::getCurl($url,$params);
+        $url = $res["url"];
+
+        $response = HttpCurl::getCurl($url);
+        if(isset($response["tbk_privilege_get_response"])){
+            return $response["tbk_privilege_get_response"]["result"]["data"];
+        }
+        $instance = new LoggerFactoryUtil(HeiMaUtil::class);
+        $instance->info("上游返回信息:".json_encode($response));
+        throw new CommonException(ErrorEnum::ERROR_SYSTEM);
+    }
+
+
+    /**
+     * 获取订单列表
+     */
+    public static function getOrderList()
+    {
+        $url = self::$baseUrl."api-order";
+        $params = [
+            "appkey"=>"",
+            "appsecret"=>"",
+            "sid"=>"",
+            "start_time"=>"mm_34231311_452000065_108585250029",
+            "end_time"=>"",
+            "page_no"=>1,
+            "page_size"=>100,
+            "signurl"=>1,
+            "query_type"=>2
+        ];
+    }
 }

+ 22 - 0
app/Http/Utils/TaoBao/TaobaoLianMengUtil.php

@@ -178,6 +178,28 @@ class TaobaoLianMengUtil extends BaseUtil
         return $res["data"];
     }
 
+    /**
+     * 获取商品详情
+     * @param $goodsId
+     * @return mixed
+     * @throws TaobaoException
+     */
+    public static function getGoodsInfo($goodsId)
+    {
+        $app = self::getApp();
+        $params = [
+            "num_iids"=>$goodsId,
+        ];
+        $res = $app->item->getInfo($params);
+        $instance = new LoggerFactoryUtil(TaobaoLianMengUtil::class);
+        $instance->info("淘宝返回数据:".json_encode($res));
+        $res = json_decode(json_encode($res),true);
+        if(isset($res["code"])){
+            throw new TaobaoException($res["sub_msg"]);
+        }
+        return $res["results"]["n_tbk_item"][0];
+    }
+
 
     /**
      * 获取饿了么外卖推广链接

+ 19 - 0
app/Http/Validate/User/UserControllerValidate.php

@@ -111,4 +111,23 @@ class UserControllerValidate extends BaseValidate
         }
         return true;
     }
+
+    /**
+     * 反馈参数校验接口
+     * @param $data
+     */
+    public function feedback($data)
+    {
+        $validate = Validator::make($data,
+            [
+                "content"=>"required",
+            ]
+        );
+        if($validate->fails()){
+            //验证错误
+            $this->setError($validate->errors()->first());
+            return false;
+        }
+        return true;
+    }
 }

+ 16 - 0
app/Models/TaobaoPidModel.php

@@ -0,0 +1,16 @@
+<?php
+
+
+namespace App\Models;
+
+
+/**
+ * 淘宝pid数据模型
+ * Class TaobaoPidModel
+ * @package App\Models
+ */
+class TaobaoPidModel extends BaseModel
+{
+    protected $table = "taobao_pid";
+
+}

+ 11 - 0
app/Models/UserFeadbackModel.php

@@ -0,0 +1,11 @@
+<?php
+
+
+namespace App\Models;
+
+
+class UserFeadbackModel extends BaseModel
+{
+    protected $table = "user_feadback";
+
+}

+ 34 - 0
public/swagger.json

@@ -1151,6 +1151,40 @@
                 }
             }
         },
+        "/user/feedback": {
+            "post": {
+                "tags": [
+                    "\u7528\u6237\u7ba1\u7406"
+                ],
+                "summary": "\u53cd\u9988\u63a5\u53e3",
+                "description": "\u53cd\u9988\u63a5\u53e3",
+                "produces": [
+                    "application/json"
+                ],
+                "parameters": [
+                    {
+                        "name": "content",
+                        "in": "query",
+                        "description": "\u53cd\u9988\u5185\u5bb9",
+                        "type": "string"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "success",
+                        "schema": {
+                            "$ref": "#/definitions/SuccessBean"
+                        }
+                    },
+                    "403": {
+                        "description": "fail",
+                        "schema": {
+                            "$ref": "#/definitions/ErrorBean"
+                        }
+                    }
+                }
+            }
+        },
         "/wechat/account/config": {
             "post": {
                 "tags": [

+ 2 - 0
routes/api.php

@@ -71,6 +71,8 @@ Route::prefix("user")->namespace("User")->middleware(["checkAuth"])->group(funct
     Route::post("cash","UserController@getCash");
     //获取用户推广二维码
     Route::get("recommend/url","UserController@getRecommendUrl");
+    //用户反馈
+    Route::post("feedback","UserController@feedback");
 });