罗永浩 3 місяців тому
батько
коміт
7520730960

+ 0 - 1
.gitignore

@@ -7,6 +7,5 @@ vendor/
 addons/admin/node_modules/
 addons/mpapp/
 .idea/
-addons/
 node_modules/
 public/uploads/*

+ 22 - 8
addons/admin/src/views/store/store.vue

@@ -600,19 +600,33 @@ export default {
 					this.$http.post('/store/confirm', this.confirmForm).then(res => {
 						loading.close();
 						if (res.data.code === 0) {
-							this.showConfirmDialog = false;
-							this.$message({ type: 'success', message: res.data.msg });
-							// 审核后,根据审核结果更新当前 tab
+							// 审核通过时显示账号密码弹窗
 							if (this.confirmForm.status == CONFIRM_STATUS.APPROVE) {
-								// 审核通过,切换到"已审核"tab
-								this.activeStatus = String(STORE_STATUS.APPROVED);
-								this.table.where.status = STORE_STATUS.APPROVED;
+								const message = res.data.msg || '';
+								const messageHtml = `<div style="line-height: 2; font-size: 14px;">
+									<p style="color: #67C23A; font-weight: bold; font-size: 16px; margin-bottom: 15px;"><i class="el-icon-success"></i> 审核通过</p>
+									<p style="margin: 10px 0; padding: 15px; background: #f5f7fa; border-radius: 4px; border-left: 4px solid #67C23A;">${message}</p>
+									<p style="color: #E6A23C; margin-top: 15px; font-size: 13px;"><i class="el-icon-warning"></i> 请务必记住账号和密码!</p>
+								</div>`;
+								this.$alert(messageHtml, '商家审核成功', {
+									confirmButtonText: '我已记住',
+									dangerouslyUseHTMLString: true,
+									type: 'success',
+									showClose: false,
+									callback: () => {
+										this.showConfirmDialog = false;
+										this.activeStatus = String(STORE_STATUS.APPROVED);
+										this.table.where.status = STORE_STATUS.APPROVED;
+										this.$refs.table.reload();
+									}
+								});
 							} else if (this.confirmForm.status == CONFIRM_STATUS.REJECT) {
-								// 审核驳回,切换到"审核失败"tab
+								this.showConfirmDialog = false;
+								this.$message({ type: 'success', message: res.data.msg });
 								this.activeStatus = String(STORE_STATUS.REJECTED);
 								this.table.where.status = STORE_STATUS.REJECTED;
+								this.$refs.table.reload();
 							}
-							this.$refs.table.reload();
 						} else {
 							this.$message.error(res.data.msg);
 						}

+ 19 - 44
app/Services/Common/StoreService.php

@@ -259,22 +259,12 @@ class StoreService extends BaseService
             // 使用事务确保数据一致性
             DB::beginTransaction();
             try {
-                // 生成随机密码(8位数字字母组合)
-                $password = $this->generatePassword();
-                
-                // 生成管理账号用户名(使用商家手机号或店铺名称拼音)
+                // 设置默认密码
+                $password = '123456';
+
+                // 使用商家手机号作为管理账号用户名
                 $username = $this->generateUsername($info);
-                
-                // 检查用户名是否已存在
-                $existingUser = UserModel::where('username', $username)
-                    ->where('mark', 1)
-                    ->first();
-                
-                if ($existingUser) {
-                    // 如果用户名已存在,添加随机后缀
-                    $username = $username . mt_rand(100, 999);
-                }
-                
+
                 // 创建管理账户
                 $adminUserId = 0;
                 if ($info->user_id > 0) {
@@ -304,22 +294,22 @@ class StoreService extends BaseService
                         'update_time' => time(),
                         'mark' => 1
                     ];
-                    
+
                     $adminUserId = UserModel::insertGetId($userData);
-                    
+
                     // 更新商家表的user_id字段
                     $info->user_id = $adminUserId;
                 }
-                
+
                 // 删除已存在的用户角色关系
-                \App\Models\UserRoleModel::where('user_id', $adminUserId)->delete();
-                
-                // 创建用户角色关系(role_id = 6)
-                \App\Models\UserRoleModel::insert([
+                DB::table('user_role')->where('user_id', $adminUserId)->delete();
+
+                // 创建用户角色关系(role_id = 6,商家角色
+                DB::table('user_role')->insert([
                     'user_id' => $adminUserId,
                     'role_id' => 6
                 ]);
-                
+
                 // 更新商家状态为已审核
                 $updateData = [
                     'status' => 1,
@@ -327,11 +317,11 @@ class StoreService extends BaseService
                     'confirm_remark' => $remark ?: '审核通过',
                     'update_time' => time()
                 ];
-                
+
                 $this->model->where('id', $id)->update($updateData);
-                
+
                 DB::commit();
-                
+
                 $this->error = '审核通过,管理账号:' . $username . ',密码:' . $password;
                 return true;
             } catch (\Exception $e) {
@@ -377,29 +367,14 @@ class StoreService extends BaseService
     }
 
     /**
-     * 生成管理账号用户名
+     * 生成管理账号用户名(使用商家手机号)
      * @param object $storeInfo 商家信息
      * @return string
      */
     private function generateUsername($storeInfo)
     {
-        // 优先使用手机号作为用户名
-        if (!empty($storeInfo->phone)) {
-            return $storeInfo->phone;
-        }
-        
-        // 如果没有手机号,使用店铺名称 + 随机数
-        if (!empty($storeInfo->name)) {
-            // 移除特殊字符,只保留字母数字
-            $name = preg_replace('/[^a-zA-Z0-9]/', '', $storeInfo->name);
-            if (strlen($name) > 20) {
-                $name = substr($name, 0, 20);
-            }
-            return $name . mt_rand(1000, 9999);
-        }
-        
-        // 如果都没有,生成随机用户名
-        return 'store_' . mt_rand(100000, 999999);
+        // 直接使用手机号作为用户名
+        return $storeInfo->phone;
     }
 
     /**

+ 7 - 6
public/index.php

@@ -11,6 +11,7 @@
 
 use Illuminate\Contracts\Http\Kernel;
 use Illuminate\Http\Request;
+
 define('LARAVEL_START', microtime(true));
 
 /*
@@ -24,12 +25,12 @@ define('LARAVEL_START', microtime(true));
 |
 */
 
-if (file_exists(__DIR__.'/../storage/framework/maintenance.php')) {
-    require __DIR__.'/../storage/framework/maintenance.php';
+if (file_exists(__DIR__ . '/../storage/framework/maintenance.php')) {
+    require __DIR__ . '/../storage/framework/maintenance.php';
 }
 
-if(!is_dir(__DIR__.'/../storage/framework/sessions')){
-    @mkdir(__DIR__.'/../storage/framework/sessions',0755, true);
+if (!is_dir(__DIR__ . '/../storage/framework/sessions')) {
+    @mkdir(__DIR__ . '/../storage/framework/sessions', 0755, true);
 }
 
 
@@ -44,7 +45,7 @@ if(!is_dir(__DIR__.'/../storage/framework/sessions')){
 |
 */
 
-require __DIR__.'/../vendor/autoload.php';
+require __DIR__ . '/../vendor/autoload.php';
 
 /*
 |--------------------------------------------------------------------------
@@ -57,7 +58,7 @@ require __DIR__.'/../vendor/autoload.php';
 |
 */
 
-$app = require_once __DIR__.'/../bootstrap/app.php';
+$app = require_once __DIR__ . '/../bootstrap/app.php';
 
 $kernel = $app->make(Kernel::class);