dyjh 6 anni fa
parent
commit
ddf77ccdfb

+ 0 - 86
app/Furniture.php

xqd
@@ -1,86 +0,0 @@
-<?php
-namespace App;
-/**
- * Created by PhpStorm.
- * User: 思维定制
- * Date: 2019/3/20
- * Time: 11:20
- */
-define('HOME_ROOT', dirname(__FILE__));
-
-
-class Furniture
-{
-
-    public static $currentItems = [];
-
-    public function __construct()
-    {
-
-    }
-
-    /**
-     * 解析路由
-     *
-     * 后台访问  /web/index.php?c=site&a=entry&m=sz_yi&do=xxx&route=module.controller.action
-     * 前台      /app/index.php....
-     *
-     * 多字母的路由用中划线隔开 比如:
-     *      TestCacheController
-     *          function testClean()
-     * 路由写法为   test-cache.test-clean
-     *
-     */
-    public static function parseRoute($requestRoute)
-    {
-        $routes = explode('.', $requestRoute);
-        dd($routes);
-        $path = self::getAppPath();
-
-        $namespace = self::getAppNamespace();
-        $action = '';
-        $controllerName = '';
-        $currentRoutes = [];
-        $modules = [];
-        if ($routes) {
-            $length = count($routes);
-            $routeFirst = array_first($routes);
-            $countRoute = count($routes);
-            if ($routeFirst === 'plugin' || self::isPlugin()) {
-                if (self::isPlugin()) {
-                    $currentRoutes[] = 'plugin';
-                    $countRoute += 1;
-                } else {
-                    $currentRoutes[] = $routeFirst;
-                    array_shift($routes);
-                }
-                $namespace = 'Yunshop';
-                $pluginName = array_shift($routes);
-                if ($pluginName || plugin($pluginName)) {
-                    $currentRoutes[] = $pluginName;
-                    $namespace .= '\\' . ucfirst(Str::camel($pluginName));
-                    $path = base_path() . '/plugins/' . $pluginName . '/src';
-                    $length = $countRoute;
-
-                    self::findRouteFile($controllerName, $action, $routes, $namespace, $path, $length, $currentRoutes, $requestRoute, true);
-
-                    if(!app('plugins')->isEnabled($pluginName)){
-                        throw new NotFoundException("{$pluginName}插件已禁用");
-
-                    }
-                } else {
-                    throw new NotFoundException('无此插件');
-
-                }
-            } else {
-
-                self::findRouteFile($controllerName, $action, $routes, $namespace, $path, $length, $currentRoutes, $requestRoute, false);
-
-            }
-        }
-        //执行run
-
-        static::run($namespace, $modules, $controllerName, $action, $currentRoutes);
-
-    }
-}

+ 7 - 0
app/Http/Controllers/Admin/Album/ManufacturerController.php

xqd xqd
@@ -68,6 +68,10 @@ class ManufacturerController extends Controller
         }
         if(!empty($data['avatar']))
             $data['avatar'] = $this->formatImgUrl($data['avatar']);
+        if (!empty($data['logo'])) {
+            $data['logo'] = $this->formatImgUrl($data['logo']);
+        }
+
         if(!empty($data['background_pic']))
             $data['background_pic'] = $this->formatImgUrl($data['background_pic']);
         if(!empty($data['advertising_pic']))
@@ -95,6 +99,9 @@ class ManufacturerController extends Controller
             $data['avatar'] = $this->formatImgUrl($data['avatar']);
             //$this->deleteUrl($saveData->avatar);
         }
+        if (!empty($data['logo'])) {
+            $data['logo'] = $this->formatImgUrl($data['logo']);
+        }
         if (!empty($data['background_pic'])) {
             $data['background_pic'] = $this->formatImgUrl($data['background_pic']);
             //$this->deleteUrl($saveData->background_pic);

+ 14 - 17
app/Http/Controllers/Api/V1/AlbumController.php

xqd
@@ -183,28 +183,25 @@ class AlbumController extends Controller
                 //print_r($check);die;
                 $save['username'] = preg_replace('/[\xf0-\xf7].{3}/', '', $datas['nickName']);
                 $save['avatar'] = $datas['avatar'];
-                $save['open_id'] = $res['openid'];
+               // $save['open_id'] = $res['openid'];
                 $save['model'] = 1;
-                $res = AlbumUserModel::where('wechat_union_id',$decryptedData['unionId'])->update($save);
+                AlbumUserModel::where('open_id',$res['openid'])->update($save);
                 //echo 111;
                     //print_r($check);die;
-                    if($check->is_dealer == 1){
-                        $user_agent = AlbumAgentModel::where([['user_id',$check->id],['status',1]])->first();
-                        $agent_id = $user_agent['id'];
-                    } else {
-                        $agent_id = '';
-                    }
-                    $user = [
-
-                        'user_id'=>$check->id,
-                        'phone'=>$check->phone,
-                        //'avatar'=>$datas['avatar'],
-                        //'username'=>$datas['nickName'],
-                        'is_agent'=>$check->is_dealer,
-                        'agent_id'=>$agent_id,
+                if($check->is_dealer == 1){
+                    $user_agent = AlbumAgentModel::where([['user_id',$check->id],['status',1]])->first();
+                    $agent_id = $user_agent['id'];
+                } else {
+                    $agent_id = '';
+                }
+                $user = [
 
-                    ];
+                    'user_id'=>$check->id,
+                    'phone'=>$check->phone,
+                    'is_agent'=>$check->is_dealer,
+                    'agent_id'=>$agent_id,
 
+                ];
             }
        // echo 111;die;
         if (Auth::loginUsingId($check->id)) {

+ 16 - 4
app/Http/Controllers/Api/V1/FurnitureController.php

xqd xqd
@@ -1082,8 +1082,14 @@ class FurnitureController extends Controller
         $session_key = $session['session_key'];
         $decryptedData = $app->encryptor->decryptData($session_key, $iv, $encryptData);
        // dd($decryptedData);
-        $userinfo = AlbumUserModel::where('wechat_union_id', $decryptedData['unionId'])->where('store_id', $storeid)->first(['id', 'username', 'wechat_open_id', 'avatar']);
 
+        if (!isset($decryptedData['unionId'])) {
+            $userinfo = AlbumUserModel::where('wechat_open_id', $openid)
+                ->where('store_id', $storeid)->first(['id', 'username', 'wechat_open_id', 'avatar']);
+        } else {
+            $userinfo = AlbumUserModel::where('wechat_union_id', $decryptedData['unionId'])
+                ->where('store_id', $storeid)->first(['id', 'username', 'wechat_open_id', 'avatar']);
+        }
         if (!$userinfo) {
             $data['wechat_open_id'] = $openid;
             $data['wechat_union_id'] = $decryptedData['unionId'];
@@ -1094,9 +1100,15 @@ class FurnitureController extends Controller
 
 
             $userinfo = AlbumUserModel::create($data);
-        }else{
-            $save['wechat_open_id'] = $openid;
-            AlbumUserModel::where('wechat_union_id',$decryptedData['unionId'])->update($save);
+        } else {
+            $save['model'] = 0;
+            $save['username'] = $request->get('nickName');
+            $save['avatar'] = $request->get('avatar');
+            if (!isset($decryptedData['unionId'])) {
+                AlbumUserModel::where('wechat_open_id', $openid)->update($save);
+            } else {
+                AlbumUserModel::where('wechat_union_id', $decryptedData['unionId'])->update($save);
+            }
         }
         $conf = AlbumManufacturerModel::where('store_id',$request->get('store_id'))->first();
         $getPhone = $conf->getPhone;

+ 1 - 0
app/Models/AlbumManufacturerModel.php

xqd
@@ -37,6 +37,7 @@ class AlbumManufacturerModel extends BaseModel
         'app_id',
         'app_secret',
         'banner',
+        'logo',
         'service_app_secret',
         'service_app_id',
         'goods_app_id',

+ 33 - 0
database/migrations/2019_03_22_100451_add_column_logo_to_album_manufacturer.php

xqd
@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddColumnLogoToAlbumManufacturer extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('album_manufacturer', function (Blueprint $table) {
+            //
+            $table->string('logo', 255)->nullable()->default(null)->comment('logo url');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('album_manufacturer', function (Blueprint $table) {
+            //
+        });
+    }
+}

+ 10 - 0
resources/views/admin/album/manufacturer/edit.blade.php

xqd
@@ -61,6 +61,16 @@
                                             </div>
 
                                         </div>
+
+                                    <div class="form-group">
+
+                                        <label class="control-label col-sm-3">厂家LOGO(130*130)</label>
+                                        <div class="col-sm-9">
+                                            {!!  widget('Tools.ImgUpload')->single2('/upload/logo','logo',"logo",  isset($data['logo'])? $data['logo'] : '',array("sizex"=>130,"sizey"=>130)) !!}
+                                        </div>
+
+                                    </div>
+
                                         <div class="form-group">
 
                                             <label class="control-label col-sm-3">产品跳转小程序appID</label>

+ 2 - 0
resources/views/admin/album/manufacturer/index.blade.php

xqd xqd
@@ -40,6 +40,7 @@
 
                                 <th class="sorting" data-sort="id"></th>
                                 <th class="sorting" data-sort="store_id">商户ID</th>
+                                <th class="sorting" data-sort="logo">商户LOGO</th>
                                 <th class="sorting" data-sort="name"> 名称</th>
                                 <th class="sorting" data-sort="illustrated_name"> 电子画报名称</th>
                                 <th class="sorting" data-sort="avatar"> 头像链接</th>
@@ -55,6 +56,7 @@
 
                                         <td>{{ $item->id }}</td>
                                         <td>{{ $item->store_id }}</td>
+                                        <td><img style="width: 50px" src="{{ $item->logo }}" alt=""></td>
                                         <td>{{ $item->name }}</td>
                                         <td>{{ $item->illustrated_name }}</td>
                                         <td><img style="width: 50px" src="{{ $item->avatar }}" alt=""></td>