帮助中心图片

pull/1/head
limu 10 months ago
parent 3f2e3b3f10
commit cfe9dd03a2
  1. 26
      app/admin/model/Store.php
  2. 2
      app/api/model/Article.php
  3. 1
      app/api/model/article/Category.php
  4. 11
      app/common/model/article/Category.php

@ -13,6 +13,7 @@ declare (strict_types=1);
namespace app\admin\model;
use app\admin\model\Page as PageModel;
use app\admin\model\store\User;
use app\common\model\Store as StoreModel;
use app\admin\model\store\User as StoreUserModel;
@ -92,6 +93,29 @@ class Store extends StoreModel
public function auditStore(array $data)
{
$storeInfo = $this->toArray();
print_r($storeInfo);exit;
if($storeInfo['status'] != 0){
$this->error = '状态异常,请勿重复操作';
return false;
}
$user = User::where(['user_id' => $storeInfo['user_id']])->find();
if (StoreUserModel::checkExist($user['mobile'])) {
$this->error = '商家用户名已存在';
return false;
}
if($data['status'] == 1){
return $this->transaction(function () use ($data) {
// 添加小程序记录
$data['is_recycle'] = 0;
if ($status = $this->save($data)) {
// 新增商家用户信息
(new StoreUserModel)->add((int)$this['store_id'], $data);
// 新增默认首页数据
(new PageModel)->insertDefault((int)$this['store_id']);
}
return $status;
});
}else{
}
}
}

@ -98,7 +98,7 @@ class Article extends ArticleModel
public function helpCenter()
{
$cat = CategoryModel::where(['status' => 1])->order('sort desc')->select()->toArray();
$cat = CategoryModel::where(['status' => 1])->with(['catImg'])->order('sort desc')->select()->toArray();
foreach ($cat as $k => $v) {
$cat[$k]['child'] = $this->where('status', '=', 1)
->where('is_delete', '=', 0)

@ -43,4 +43,5 @@ class Category extends CategoryModel
{
return $this->getList(['status' => 1]);
}
}

@ -13,6 +13,7 @@ declare (strict_types=1);
namespace app\common\model\article;
use cores\BaseModel;
use think\model\relation\HasOne;
/**
* 文章分类模型
@ -37,6 +38,16 @@ class Category extends BaseModel
return static::get($categoryId);
}
/**
* 关联用户头像表
* @return HasOne
*/
public function catImg(): HasOne
{
return $this->hasOne('UploadFile', 'file_id', 'img_id')
->bind(['img_url' => 'preview_url']);
}
/**
* 获取列表
* @param array $where

Loading…
Cancel
Save