线报提交内容

lszyh
zengyyh 1 month ago
parent ee5942fcb5
commit 9100c67361
  1. 10
      app/api/controller/Goods.php
  2. 18
      app/api/controller/Store.php
  3. 78
      app/common/model/OpenShop.php
  4. 70
      app/common/model/Tipoff.php
  5. 19
      app/store/controller/Goods.php
  6. 8
      app/store/controller/Store.php

@ -20,6 +20,7 @@ use EasyWeChat\Factory;
use app\api\service\Setting as SettingService;
use app\common\service\GoodsCateEs;
use app\common\service\Jd;
use app\common\model\Tipoff as ModelTipoff;
/**
* 商品控制器
@ -531,4 +532,13 @@ class Goods extends Controller
return $this->renderSuccess(['detail' => $goodsInfo]);
}
public function tipOffList()
{
$params = $this->request->param();
$model = new ModelTipoff;
$list = $model->getList($params);
return $this->renderSuccess(compact('list'));
}
}

@ -23,6 +23,7 @@ use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\response\Json;
use app\common\model\OpenShop;
/**
* 商城基础信息
@ -215,5 +216,22 @@ class Store extends Controller
return $this->renderSuccess($list);
}
/**
* 开通商城提交的信息
*/
public function openShop()
{
$userId = UserService::getCurrentLoginUserId();
$params = $this->postForm();
$params['user_id'] = $userId;
$params['store_id'] = $this->storeId;
$model =new OpenShop();
if(!$model->add($params)){
return $this->renderError($model->getError() ?: '提交失败');
}
return $this->renderSuccess('提交成功,请耐心等待');
}
}

@ -0,0 +1,78 @@
<?php
declare (strict_types=1);
namespace app\common\model;
use cores\BaseModel;
use think\facade\Db;
use app\common\model\UploadFile;
use function Qcloud\Cos\encodeKey;
class OpenShop extends BaseModel
{
protected $name = 'open_shop';
protected $pk = 'id';
public function add(array $data)
{
return $this->save($data);
}
public function select888()
{
return self::select();
}
public function getList(array $param = [])
{
$filter = $this->getQueryFilter($param);
// 商品信息查询
$list = $this->where($filter)->order('create_time', 'desc')->paginate($param['pageSize'] ?? 15)->toArray();
foreach ($list['data'] as &$value) {
$value['card_front_url'] = UploadFile::withoutGlobalScope()->where("file_id", $value['id_card_front_id'])->select();
$value['card_back_url'] = UploadFile::withoutGlobalScope()->where("file_id", $value['id_card_back_id'])->select();
$value['business_license_url'] = UploadFile::withoutGlobalScope()->where("file_id", $value['business_license_id'])->select();
$value['photo_url'] = UploadFile::withoutGlobalScope()->where("file_id", $value['photo_id'])->select();
$value['qr_code_url'] = UploadFile::withoutGlobalScope()->where("file_id", $value['qr_code_id'])->select();
$value['merchant_name_url'] = UploadFile::withoutGlobalScope()->where("file_id", $value['merchant_name_id'])->select();
}
return $list;
}
public function getQueryFilter(array $param)
{
// 设置默认的检索数据
$params = $this->setQueryDefaultValue($param, [
'name' =>"", // 查询内容
'mobile' => "", // 手机号
'betweenTime' => [] // 起止时间
]);
// 检索查询条件
$filter = [];
// 起止时间
if (!empty($params['betweenTime'])) {
$times = between_time($params['betweenTime']);
if (isset($times['start_time']) && isset($times['end_time'])) {
$filter[] = ['create_time', '>=', $times['start_time']];
$filter[] = ['create_time', '<', $times['end_time'] + 86400];
}
}
// 渠道名称
if (!empty($params['name'])) {
$filter[] = ['name', 'like', "%{$params['name']}%"];
}
// 查询内容
if (!empty($params['mobile'])) {
$filter[] = ['mobile', 'like', "%{$params['mobile']}%"];
}
return $filter;
}
}

@ -6,6 +6,7 @@ namespace app\common\model;
use cores\BaseModel;
use app\common\service\Jd;
use app\store\model\Goods as GoodsModel;
class Tipoff extends BaseModel
{
@ -22,19 +23,23 @@ class Tipoff extends BaseModel
public function getList(array $param = [])
{
$filter = $this->getQueryFilter($param);
$list = $this->alias('tipoff')
->where($filter)
->join('goods', 'goods.goods_id = tipoff.goods_id')
->field('tipoff.*,goods.*')
->order(['tipoff.create_time' => 'desc'])
->paginate($param['pageSize'] ?? 15);
$jd = new Jd();
foreach ($list as $key => $value) {
//京东短链
$jd_short_url = $jd->getJdShortLink($value->goods_no);
$value['jd_short_url'] = $jd_short_url;
$list = $this->where($filter)->order('create_time', 'desc')->paginate($param['pageSize'] ?? 15)->toArray();
foreach ($list['data'] as &$value) {
if (isset($value['goods_id'])) {
// 确保 $value['goods_id'] 是一个数组
$value['goods'] = Goods::where('goods_id','in', $value['goods_id'])->select();
}
// foreach ( $value['goods'] as $key => $val) {
// //京东短链
// $jd_short_url = $jd->getJdShortLink($val->goods_no);
// $val['jd_short_url'] = $jd_short_url;
// }
}
return $list;
}
@ -42,24 +47,45 @@ class Tipoff extends BaseModel
{
// 设置默认的检索数据
$params = $this->setQueryDefaultValue($param, [
'header_content' =>"", // 查询内容
'channel' => "", // 渠道
'betweenTime' => [] // 起止时间
'header_content' => "", // 查询内容
'channel_name' => "", // 渠道
'betweenTime' => [] // 起止时间
]);
// 检索查询条件
$filter = [];
// 起止时间
if (!empty($params['create_time'])) {
$times = between_time($params['create_time']);
$filter[] = ['tipoff.create_time', '>=', $times['create_time']];
$filter[] = ['tipoff.create_time', '<', $times['create_time'] + 86400];
if (!empty($params['betweenTime'])) {
$times = between_time($params['betweenTime']);
if (isset($times['start_time']) && isset($times['end_time'])) {
$filter[] = ['create_time', '>=', $times['start_time']];
$filter[] = ['create_time', '<', $times['end_time'] + 86400];
}
}
// 渠道名称
if (!empty($params['channel_name'])) {
$filter[] = ['channel_name', 'like', "%{$params['channel_name']}%"];
}
// 查询内容
if (!empty($params['header_content'])) {
$filter[] = ['header_content', 'like', "%{$params['header_content']}%"];
}
return $filter;
}
!empty($params['channel_name']) && $filter[] = ['tipoff.channel_name', 'like', "%{$params['channel_name']}%"];
!empty($params['header_content']) && $filter[] = ['tipoff.header_content', 'like', "%{$params['header_content']}%"];
public function deleteTipoff($ids)
{
// 检查 $ids 是否为空或 null
if (empty($ids)) {
return false; // 或者抛出一个异常,具体取决于业务需求
}
return $filter;
return $this->where('id', 'in', $ids)->delete();
}

@ -602,14 +602,6 @@ class Goods extends Controller
{
$params = $this->postForm();
$model = new GoodsModel;
$goods = $model->where("goods_id", "in", $params['goods_id'])->select();
// $jd = new Jd();
// foreach ($goods as $key => $value) {
// //京东短链
// $jd_short_url = $jd->getJdShortLink($value->goods_no);
// $value['jd_short_url'] = $jd_short_url;
// }
// $params['goods'] = $goods;
$params['store_id'] = $this->storeId;
$Tipoff = new ModelTipoff();
@ -627,4 +619,15 @@ class Goods extends Controller
return $this->renderSuccess(compact('result'));
}
public function deleteTipOff()
{
$ids = $this->postForm('ids');
$model = new ModelTipoff;
if(!$model->deleteTipOff($ids)){
return $this->renderError($model->getError() ?: '操作失败');
}
return $this->renderSuccess('操作成功');
}
}

@ -18,6 +18,7 @@ use app\store\model\Store as StoreModel;
use app\admin\model\Store as AdminStoreModel;
use app\common\model\Channel;
use app\common\model\PriceSet;
use app\common\model\OpenShop;
/**
* 商家中心控制器
@ -206,5 +207,12 @@ class Store extends Controller
$data['type'] = $type;
return $this->renderSuccess($data);
}
public function getOpenShopList()
{
$model = new OpenShop();
$list = $model->getList();
return $this->renderSuccess(compact('list'));
}
}

Loading…
Cancel
Save