This commit is contained in:
luofei 2024-02-20 15:59:46 +08:00
commit 9c847b1321
104 changed files with 12488 additions and 42 deletions

View File

@ -0,0 +1,57 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\common\dao\store\order;
use app\common\dao\BaseDao;
use app\common\model\store\order\SupplyReconciliation as model;
use app\common\repositories\system\admin\AdminRepository;
use app\common\repositories\system\supply\SupplyRepository;
class SupplyReconciliationDao extends BaseDao
{
public function getModel(): string
{
return model::class;
}
public function search(array $where)
{
$query = ($this->getModel()::getDB())
->when(isset($where['mer_id']) && $where['mer_id'] != '' ,function($query)use($where){
$query->where('mer_id',$where['mer_id']);
})->when(isset($where['status']) && $where['status'] != '' ,function($query)use($where){
$query->where('status',$where['status']);
})->when(isset($where['is_accounts']) && $where['is_accounts'] != '' ,function($query)use($where){
$query->where('is_accounts',$where['is_accounts']);
})->when(isset($where['date']) && $where['date'] != '' ,function($query)use($where){
getModelTime($query,$where['date']);
})->when(isset($where['reconciliation_id']) && $where['reconciliation_id'] != '' ,function($query)use($where){
$query->where('reconciliation_id',$where['reconciliation_id']);
})
->when(isset($where['keyword']) && $where['keyword'] !== '',function($query)use($where){
$make = app()->make(AdminRepository::class);
$admin_id = $make->getSearch(['real_name' => $where['keyword']],null,false)->column('admin_id');
$query->where(function($query) use($admin_id,$where){
if(isset($where['mer_id'])){
$query->where('admin_id','in',$admin_id);
}else {
$mer_make = app()->make(SupplyRepository::class);
$mer_id = $mer_make->getSearch(['keyword' => $where['keyword']])->column('mer_id');
$query->where('admin_id','in',$admin_id)->whereOr('mer_id','in',$mer_id);
}
});
});
return $query->order('create_time DESC,status DESC');
}
}

View File

@ -15,7 +15,7 @@ namespace app\common\dao\system\supply;
use app\common\dao\BaseDao; use app\common\dao\BaseDao;
use app\common\model\system\merchant\FinancialRecord; use app\common\model\system\supply\FinancialRecord;
class FinancialRecordDao extends BaseDao class FinancialRecordDao extends BaseDao
{ {

View File

@ -15,7 +15,7 @@ namespace app\common\dao\system\supply;
use app\common\dao\BaseDao; use app\common\dao\BaseDao;
use app\common\model\system\merchant\MerchantAdmin; use app\common\model\system\supply\SupplyAdmin;
use think\db\BaseQuery; use think\db\BaseQuery;
use think\db\exception\DataNotFoundException; use think\db\exception\DataNotFoundException;
use think\db\exception\DbException; use think\db\exception\DbException;
@ -25,7 +25,7 @@ use think\Model;
/** /**
* Class SupplyAdminDao * Class SupplyAdminDao
* @package app\common\dao\system\merchant * @package app\common\dao\system\supply
* @author xaboy * @author xaboy
* @day 2020-04-17 * @day 2020-04-17
*/ */
@ -39,7 +39,7 @@ class SupplyAdminDao extends BaseDao
*/ */
protected function getModel(): string protected function getModel(): string
{ {
return MerchantAdmin::class; return SupplyAdmin::class;
} }
/** /**
@ -52,7 +52,7 @@ class SupplyAdminDao extends BaseDao
*/ */
public function search(int $merId, array $where = [], ?int $level = null) public function search(int $merId, array $where = [], ?int $level = null)
{ {
$query = MerchantAdmin::getDB()->where('is_del', 0)->where('mer_id', $merId) $query = SupplyAdmin::getDB()->where('is_del', 0)->where('mer_id', $merId)
->when(isset($where['date']) && $where['date'] !== '', function ($query) use ($where) { ->when(isset($where['date']) && $where['date'] !== '', function ($query) use ($where) {
getModelTime($query, $where['date']); getModelTime($query, $where['date']);
}); });
@ -78,7 +78,7 @@ class SupplyAdminDao extends BaseDao
*/ */
public function merIdByAccount(int $merId): string public function merIdByAccount(int $merId): string
{ {
return MerchantAdmin::getDB()->where('mer_id', $merId)->where('level', 0)->value('account'); return SupplyAdmin::getDB()->where('mer_id', $merId)->where('level', 0)->value('account');
} }
/** /**
@ -92,7 +92,7 @@ class SupplyAdminDao extends BaseDao
*/ */
public function merIdByAdmin(int $merId) public function merIdByAdmin(int $merId)
{ {
return MerchantAdmin::getDB()->where('mer_id', $merId)->where('level', 0)->find(); return SupplyAdmin::getDB()->where('mer_id', $merId)->where('level', 0)->find();
} }
/** /**
@ -107,7 +107,7 @@ class SupplyAdminDao extends BaseDao
*/ */
public function accountByAdmin(string $account, int $merId) public function accountByAdmin(string $account, int $merId)
{ {
return MerchantAdmin::getInstance()->where('account', $account) return SupplyAdmin::getInstance()->where('account', $account)
->where('is_del', 0)->where('mer_id', $merId) ->where('is_del', 0)->where('mer_id', $merId)
->field(['account', 'pwd', 'real_name', 'login_count', 'merchant_admin_id', 'status', 'mer_id']) ->field(['account', 'pwd', 'real_name', 'login_count', 'merchant_admin_id', 'status', 'mer_id'])
->find(); ->find();
@ -124,7 +124,7 @@ class SupplyAdminDao extends BaseDao
*/ */
public function accountByTopAdmin(string $account) public function accountByTopAdmin(string $account)
{ {
return MerchantAdmin::getInstance()->where('account', $account) return SupplyAdmin::getInstance()->where('account', $account)
->where('is_del', 0)->where('level', 0) ->where('is_del', 0)->where('level', 0)
->field(['account', 'pwd', 'real_name', 'login_count', 'merchant_admin_id', 'status', 'mer_id']) ->field(['account', 'pwd', 'real_name', 'login_count', 'merchant_admin_id', 'status', 'mer_id'])
->find(); ->find();
@ -138,7 +138,7 @@ class SupplyAdminDao extends BaseDao
*/ */
public function accountByMerchantId(string $account) public function accountByMerchantId(string $account)
{ {
return MerchantAdmin::getInstance()->where('account', $account)->value('mer_id'); return SupplyAdmin::getInstance()->where('account', $account)->value('mer_id');
} }
@ -153,7 +153,7 @@ class SupplyAdminDao extends BaseDao
*/ */
public function get( $id) public function get( $id)
{ {
return MerchantAdmin::getInstance()->where('is_del', 0)->find($id); return SupplyAdmin::getInstance()->where('is_del', 0)->find($id);
} }
/** /**
@ -166,7 +166,7 @@ class SupplyAdminDao extends BaseDao
*/ */
public function exists(int $id, int $merId = 0, ?int $level = null) public function exists(int $id, int $merId = 0, ?int $level = null)
{ {
$query = MerchantAdmin::getDB()->where($this->getPk(), $id)->where('is_del', 0); $query = SupplyAdmin::getDB()->where($this->getPk(), $id)->where('is_del', 0);
if ($merId) $query->where('mer_id', $merId); if ($merId) $query->where('mer_id', $merId);
if (!is_null($level)) $query->where('level', $level); if (!is_null($level)) $query->where('level', $level);
return $query->count() > 0; return $query->count() > 0;
@ -183,7 +183,7 @@ class SupplyAdminDao extends BaseDao
*/ */
public function merFieldExists(int $merId, $field, $value, ?int $except = null): bool public function merFieldExists(int $merId, $field, $value, ?int $except = null): bool
{ {
$query = MerchantAdmin::getDB()->where($field, $value)->where('mer_id', $merId); $query = SupplyAdmin::getDB()->where($field, $value)->where('mer_id', $merId);
if (!is_null($except)) $query->where($this->getPk(), '<>', $except); if (!is_null($except)) $query->where($this->getPk(), '<>', $except);
return $query->count() > 0; return $query->count() > 0;
} }
@ -196,7 +196,7 @@ class SupplyAdminDao extends BaseDao
*/ */
public function topExists(int $id) public function topExists(int $id)
{ {
$query = MerchantAdmin::getDB()->where($this->getPk(), $id)->where('is_del', 0)->where('level', 0); $query = SupplyAdmin::getDB()->where($this->getPk(), $id)->where('is_del', 0)->where('level', 0);
return $query->count() > 0; return $query->count() > 0;
} }
@ -208,11 +208,11 @@ class SupplyAdminDao extends BaseDao
*/ */
public function merchantIdByTopAdminId(int $merId) public function merchantIdByTopAdminId(int $merId)
{ {
return MerchantAdmin::getDB()->where('mer_id', $merId)->where('is_del', 0)->where('level', 0)->value('merchant_admin_id'); return SupplyAdmin::getDB()->where('mer_id', $merId)->where('is_del', 0)->where('level', 0)->value('merchant_admin_id');
} }
public function deleteMer($merId) public function deleteMer($merId)
{ {
MerchantAdmin::getDB()->where('mer_id', $merId)->update(['account' => Db::raw('CONCAT(`account`,\'$del\')')]); SupplyAdmin::getDB()->where('mer_id', $merId)->update(['account' => Db::raw('CONCAT(`account`,\'$del\')')]);
} }
} }

View File

@ -14,13 +14,13 @@
namespace app\common\dao\system\supply; namespace app\common\dao\system\supply;
use app\common\dao\BaseDao; use app\common\dao\BaseDao;
use app\common\model\system\merchant\MerchantApplyments; use app\common\model\system\supply\SupplyApplyments;
class SupplyAppymentsDao extends BaseDao class SupplyAppymentsDao extends BaseDao
{ {
protected function getModel(): string protected function getModel(): string
{ {
return MerchantApplyments::class; return SupplyApplyments::class;
} }
public function search(array $where) public function search(array $where)

View File

@ -16,13 +16,13 @@ namespace app\common\dao\system\supply;
use app\common\dao\BaseDao; use app\common\dao\BaseDao;
use app\common\model\BaseModel; use app\common\model\BaseModel;
use app\common\model\system\merchant\MerchantCategory; use app\common\model\system\supply\SupplyCategory;
use think\db\BaseQuery; use think\db\BaseQuery;
use think\facade\Db; use think\facade\Db;
/** /**
* Class MerchantCategoryDao * Class SupplyCategoryDao
* @package app\common\dao\system\merchant * @package app\common\dao\system\supply
* @author xaboy * @author xaboy
* @day 2020-05-06 * @day 2020-05-06
*/ */
@ -36,7 +36,7 @@ class SupplyCategoryDao extends BaseDao
*/ */
protected function getModel(): string protected function getModel(): string
{ {
return MerchantCategory::class; return SupplyCategory::class;
} }
@ -48,7 +48,7 @@ class SupplyCategoryDao extends BaseDao
*/ */
public function search(array $where = []) public function search(array $where = [])
{ {
return MerchantCategory::getDB(); return SupplyCategory::getDB();
} }
/** /**
@ -58,7 +58,7 @@ class SupplyCategoryDao extends BaseDao
*/ */
public function allOptions() public function allOptions()
{ {
$data = MerchantCategory::getDB()->column('category_name', 'merchant_category_id'); $data = SupplyCategory::getDB()->column('category_name', 'merchant_category_id');
$options = []; $options = [];
foreach ($data as $value => $label) { foreach ($data as $value => $label) {
$options[] = compact('value', 'label'); $options[] = compact('value', 'label');
@ -68,7 +68,7 @@ class SupplyCategoryDao extends BaseDao
public function dateMerchantPriceGroup($date, $limit = 4) public function dateMerchantPriceGroup($date, $limit = 4)
{ {
return MerchantCategory::getDB()->alias('A')->leftJoin('Merchant B', 'A.merchant_category_id = B.category_id') return SupplyCategory::getDB()->alias('A')->leftJoin('Merchant B', 'A.merchant_category_id = B.category_id')
->leftJoin('StoreOrder C', 'C.mer_id = B.mer_id')->field(Db::raw('sum(C.pay_price) as pay_price,A.category_name')) ->leftJoin('StoreOrder C', 'C.mer_id = B.mer_id')->field(Db::raw('sum(C.pay_price) as pay_price,A.category_name'))
->when($date, function ($query, $date) { ->when($date, function ($query, $date) {
getModelTime($query, $date, 'C.pay_time'); getModelTime($query, $date, 'C.pay_time');
@ -77,6 +77,6 @@ class SupplyCategoryDao extends BaseDao
public function names(array $ids) public function names(array $ids)
{ {
return MerchantCategory::getDB()->whereIn('merchant_category_id', $ids)->column('category_name'); return SupplyCategory::getDB()->whereIn('merchant_category_id', $ids)->column('category_name');
} }
} }

View File

@ -15,7 +15,7 @@ namespace app\common\dao\system\supply;
use app\common\dao\BaseDao; use app\common\dao\BaseDao;
use app\common\model\system\merchant\Merchant; use app\common\model\system\supply\Supply;
use crmeb\services\VicWordService; use crmeb\services\VicWordService;
use think\db\BaseQuery; use think\db\BaseQuery;
use think\db\exception\DataNotFoundException; use think\db\exception\DataNotFoundException;
@ -34,7 +34,7 @@ class SupplyDao extends BaseDao
*/ */
protected function getModel(): string protected function getModel(): string
{ {
return Merchant::class; return Supply::class;
} }
/** /**
@ -45,7 +45,7 @@ class SupplyDao extends BaseDao
*/ */
public function search(array $where, $is_del = 0) public function search(array $where, $is_del = 0)
{ {
$query = Merchant::getDB() $query = Supply::getDB()
->when($is_del !== null, function ($query) use ($is_del) { ->when($is_del !== null, function ($query) use ($is_del) {
$query->where('is_del', $is_del); $query->where('is_del', $is_del);
}) })
@ -141,7 +141,7 @@ class SupplyDao extends BaseDao
*/ */
public function get($id) public function get($id)
{ {
return Merchant::getInstance()->where('is_del', 0)->find($id); return Supply::getInstance()->where('is_del', 0)->find($id);
} }
/** /**
@ -150,7 +150,7 @@ class SupplyDao extends BaseDao
*/ */
public function apiGetOne($id) public function apiGetOne($id)
{ {
return Merchant::getInstance()->where(['is_del' => 0, 'status' => 1, 'mer_state' => 1])->find($id); return Supply::getInstance()->where(['is_del' => 0, 'status' => 1, 'mer_state' => 1])->find($id);
} }
/** /**
@ -184,7 +184,7 @@ class SupplyDao extends BaseDao
public function dateMerchantNum($date) public function dateMerchantNum($date)
{ {
return Merchant::getDB()->where('is_del', 0)->when($date, function ($query, $date) { return Supply::getDB()->where('is_del', 0)->when($date, function ($query, $date) {
getModelTime($query, $date); getModelTime($query, $date);
})->count(); })->count();
} }
@ -198,7 +198,7 @@ class SupplyDao extends BaseDao
*/ */
public function getCopyNum(int $merId) public function getCopyNum(int $merId)
{ {
return Merchant::getDB()->where('mer_id', $merId)->value('copy_product_num'); return Supply::getDB()->where('mer_id', $merId)->value('copy_product_num');
} }
/** /**
@ -231,7 +231,7 @@ class SupplyDao extends BaseDao
public function names(array $ids) public function names(array $ids)
{ {
return Merchant::getDB()->whereIn('mer_id',$ids)->column('mer_name'); return Supply::getDB()->whereIn('mer_id',$ids)->column('mer_name');
} }
/** /**
@ -272,7 +272,7 @@ class SupplyDao extends BaseDao
public function clearTypeId(int $typeId) public function clearTypeId(int $typeId)
{ {
return Merchant::getDB()->where('type_id', $typeId)->update(['type_id' => 0]); return Supply::getDB()->where('type_id', $typeId)->update(['type_id' => 0]);
} }
public function addFieldNum(int $merId, int $num, string $field) public function addFieldNum(int $merId, int $num, string $field)

View File

@ -14,13 +14,13 @@
namespace app\common\dao\system\supply; namespace app\common\dao\system\supply;
use app\common\dao\BaseDao; use app\common\dao\BaseDao;
use app\common\model\system\merchant\MerchantIntention; use app\common\model\system\supply\SupplyIntention;
class SupplyIntentionDao extends BaseDao class SupplyIntentionDao extends BaseDao
{ {
protected function getModel(): string protected function getModel(): string
{ {
return MerchantIntention::class; return SupplyIntention::class;
} }
public function search(array $where) public function search(array $where)

View File

@ -15,19 +15,19 @@ namespace app\common\dao\system\supply;
use app\common\dao\BaseDao; use app\common\dao\BaseDao;
use app\common\model\BaseModel; use app\common\model\BaseModel;
use app\common\model\system\merchant\MerchantType; use app\common\model\system\supply\SupplyType;
class SupplyTypeDao extends BaseDao class SupplyTypeDao extends BaseDao
{ {
protected function getModel(): string protected function getModel(): string
{ {
return MerchantType::class; return SupplyType::class;
} }
public function search(array $where = []) public function search(array $where = [])
{ {
return MerchantType::getDB() return SupplyType::getDB()
->when(isset($where['mer_type_id']) && $where['mer_type_id'] !== '',function($query) use($where){ ->when(isset($where['mer_type_id']) && $where['mer_type_id'] !== '',function($query) use($where){
$query->where('mer_type_id',$where['mer_type_id']); $query->where('mer_type_id',$where['mer_type_id']);
}); });
@ -35,7 +35,7 @@ class SupplyTypeDao extends BaseDao
public function getOptions() public function getOptions()
{ {
$data = MerchantType::getDB()->column('type_name', 'mer_type_id'); $data = SupplyType::getDB()->column('type_name', 'mer_type_id');
$options = []; $options = [];
foreach ($data as $value => $label) { foreach ($data as $value => $label) {
$options[] = compact('value', 'label'); $options[] = compact('value', 'label');
@ -45,7 +45,7 @@ class SupplyTypeDao extends BaseDao
public function getMargin() public function getMargin()
{ {
$data = MerchantType::getDB()->column('margin,is_margin', 'mer_type_id'); $data = SupplyType::getDB()->column('margin,is_margin', 'mer_type_id');
$options = []; $options = [];
foreach ($data as $value => $item) { foreach ($data as $value => $item) {
if ($item['is_margin'] == 1) { if ($item['is_margin'] == 1) {

View File

@ -0,0 +1,121 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\common\dao\user;
use app\common\dao\BaseDao;
use app\common\model\BaseModel;
use app\common\model\user\UserLabel;
use app\common\model\user\UserSupply;
use think\db\BaseQuery;
/**
* Class UserSupplyDao
* @package app\common\dao\user
* @author xaboy
* @day 2020/10/20
*/
class UserSupplyDao extends BaseDao
{
/**
* @return string
* @author xaboy
* @day 2020/10/20
*/
protected function getModel(): string
{
return UserSupply::class;
}
/**
* @param $uid
* @param $mer_id
* @return bool
* @author xaboy
* @day 2020/10/20
*/
public function isMerUser($uid, $mer_id)
{
return $this->existsWhere(compact('uid', 'mer_id'));
}
/**
* @param $uid
* @param $mer_id
* @return int
* @throws \think\db\exception\DbException
* @author xaboy
* @day 2020/10/20
*/
public function updateLastTime($uid, $mer_id)
{
return UserSupply::getDB()->where(compact('uid', 'mer_id'))->update([
'last_time' => date('Y-m-d H:i:s')
]);
}
/**
* @param array $where
* @return mixed
* @author xaboy
* @day 2020/10/20
*/
public function search(array $where)
{
return UserSupply::getDB()->alias('A')->leftJoin('User B', 'A.uid = B.uid')
->when(isset($where['mer_id']) && $where['mer_id'] !== '', function ($query) use ($where) {
$query->where('A.mer_id', $where['mer_id']);
})->when(isset($where['nickname']) && $where['nickname'], function (BaseQuery $query) use ($where) {
return $query->where('B.nickname', 'like', '%' . $where['nickname'] . '%');
})->when(isset($where['sex']) && $where['sex'] !== '', function (BaseQuery $query) use ($where) {
return $query->where('B.sex', intval($where['sex']));
})->when(isset($where['is_promoter']) && $where['is_promoter'] !== '', function (BaseQuery $query) use ($where) {
return $query->where('B.is_promoter', $where['is_promoter']);
})->when(isset($where['uids']), function (BaseQuery $query) use ($where) {
return $query->whereIn('A.uid', $where['uids']);
})->when(isset($where['user_time_type']) && $where['user_time_type'] !== '' && $where['user_time'] != '', function ($query) use ($where) {
if ($where['user_time_type'] == 'visit') {
getModelTime($query, $where['user_time'], 'A.last_time');
}
if ($where['user_time_type'] == 'add_time') {
getModelTime($query, $where['user_time'], 'A.create_time');
}
})->when(isset($where['pay_count']) && $where['pay_count'] !== '', function ($query) use ($where) {
if ($where['pay_count'] == -1) {
$query->where('A.pay_num', 0);
} else {
$query->where('A.pay_num', '>', $where['pay_count']);
}
})->when(isset($where['label_id']) && $where['label_id'] !== '', function (BaseQuery $query) use ($where) {
return $query->whereRaw('CONCAT(\',\',A.label_id,\',\') LIKE \'%,' . $where['label_id'] . ',%\'');
})->when(isset($where['user_type']) && $where['user_type'] !== '', function (BaseQuery $query) use ($where) {
return $query->where('B.user_type', $where['user_type']);
})->where('A.status', 1);
}
public function numUserIds($mer_id, $min, $max = null)
{
return UserSupply::getDB()->where('mer_id', $mer_id)->where('pay_num', '>=', $min)->when(!is_null($max), function ($query) use ($max) {
$query->where('pay_num', '<=', $max);
})->group('uid')->column('uid');
}
public function priceUserIds($mer_id, $min, $max = null)
{
return UserSupply::getDB()->where('mer_id', $mer_id)->where('pay_price', '>=', $min)->when(!is_null($max), function ($query) use ($max, $min) {
$query->where('pay_price', $min == $max ? '<=' : '<', $max);
})->group('uid')->column('uid');
}
}

View File

@ -0,0 +1,56 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\common\model\store\order;
use app\common\model\BaseModel;
use app\common\model\system\admin\Admin;
use app\common\model\system\supply\Supply;
class SupplyReconciliation extends BaseModel
{
public static function tablePk(): ?string
{
return 'reconciliation_id';
}
public static function tableName(): string
{
return 'eb_supply_reconciliation';
}
public function withOrder()
{
return $this->hasMany(MerchantReconciliationOrder::class,'reconciliation_id','reconciliation_id');
}
public function merchant()
{
return $this->hasOne(Supply::class,'mer_id','mer_id');
}
public function admin()
{
return $this->hasOne(Admin::class,'admin_id','admin_id');
}
/**
* 计算扣除费用
* @Author:Qinii
* @Date: 2020/10/15
* @return string
*/
public function getChargeAttr()
{
return bcadd(bcadd(bcadd($this->order_extension,$this->order_rate,2),$this->refund_price,2),$this->refund_extensionthis,2);
}
}

View File

@ -0,0 +1,79 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\common\model\user;
use app\common\model\BaseModel;
/**
* Class UserSupply
* @package app\common\model\user
* @author xaboy
* @day 2020/10/20
*/
class UserSupply extends BaseModel
{
/**
* @return string|null
* @author xaboy
* @day 2020/10/20
*/
public static function tablePk(): ?string
{
return 'user_merchant_id';
}
/**
* @return string
* @author xaboy
* @day 2020/10/20
*/
public static function tableName(): string
{
return 'user_supply';
}
public function user()
{
return $this->hasOne(User::class, 'uid', 'uid');
}
/**
* @param $value
* @return array
* @author xaboy
* @day 2020-05-09
*/
public function getLabelIdAttr($value)
{
return $value ? explode(',', $value) : [];
}
/**
* @param $value
* @return string
* @author xaboy
* @day 2020-05-09
*/
public function setLabelIdAttr($value)
{
return implode(',', $value);
}
public function getAuthLabelAttr()
{
return app()->make(UserLabel::class)->whereIn('label_id', $this->label_id)->where('mer_id', $this->mer_id)->where('type', 1)->column('label_id');
}
}

View File

@ -0,0 +1,312 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\common\repositories\store\order;
use app\common\repositories\BaseRepository;
use app\common\dao\store\order\SupplyReconciliationDao as dao;
use app\common\repositories\store\order\StoreOrderRepository;
use app\common\repositories\store\order\StoreRefundOrderRepository;
use app\common\repositories\system\supply\SupplyRepository;
use crmeb\services\SwooleTaskService;
use think\exception\ValidateException;
use think\facade\Db;
use FormBuilder\Factory\Elm;
use think\facade\Route;
class SupplyReconciliationRepository extends BaseRepository
{
public function __construct(dao $dao)
{
$this->dao = $dao;
}
public function getWhereCountById($id)
{
$where = ['reconciliation_id' => $id,'status' => 2];
return $this->dao->getWhereCount($where) > 0 ;
}
public function merWhereCountById($id,$merId)
{
$where = ['reconciliation_id' => $id,'mer_id' => $merId,'is_accounts' => 0,'status' => 0];
return ($this->dao->getWhereCount($where) > 0) ;
}
/**
* TODO 列表
* @param $where
* @param $page
* @param $limit
* @return array
* @author Qinii
* @day 2020-06-15
*/
public function getList($where,$page,$limit)
{
$query = $this->dao->search($where)->with([
'merchant' => function($query){
$query->field('mer_id,mer_name');
},
'admin' =>function($query){
$query->field('admin_id,real_name');
}]);
$count = $query->count();
$list = $query->page($page,$limit)->select()->append(['charge'])->each(function($item){
if($item->type == 1) return $item->price = '-'.$item->price;
});
return compact('count','list');
}
/**
* TODO 创建对账单
* @param $id
* @param $data
* @author Qinii
* @day 2020-06-15
*/
public function create(int $id, array $data)
{
$orderMake = app()->make(StoreOrderRepository::class);
$refundMake = app()->make(StoreRefundOrderRepository::class);
$bank = merchantConfig($id,'bank');
$bank_name = merchantConfig($id,'bank_name');
$bank_number = merchantConfig($id,'bank_number');
$bank_address = merchantConfig($id,'bank_address');
if( !$bank || !$bank_name || !$bank_number || !$bank_address )
throw new ValidateException('商户未填写银行卡信息');
$order_ids = $data['order_ids'];
$refund_order_ids = $data['refund_order_ids'];
if($data['order_type']) { //全选
$order_ids = $orderMake->search([
'date' => $data['date'],
'mer_id' => $id,
'paid' => 1,
'order_id'
], null
)->whereNotIn('order_id', $data['order_out_ids'])->column('order_id');
}
if($data['refund_type']){ //全选
$refund_order_ids = $refundMake->search([
'date' => $data['date'],
'mer_id' => $id,
'reconciliation_type' => 0,
'status' => 3
])->whereNotIn('refund_order_id',$data['refund_out_ids'])->column('refund_order_id');
}
if(is_array($order_ids) && (count($order_ids) < 1) && is_array($refund_order_ids) && (count($refund_order_ids) < 1)){
throw new ValidateException('没有数据可对账');
}
$compute = $this->compute($id,$order_ids,$refund_order_ids);
$createData = [
'status' => 0,
'mer_id' => $id,
'is_accounts' => 0,
'mer_admin_id' => 0,
'bank' => $bank,
'bank_name' => $bank_name,
'bank_number' => $bank_number,
'bank_address' => $bank_address,
'admin_id' => $data['adminId'],
'price' => round($compute['price'],2),
'order_price' => round($compute['order_price'],2),
'refund_price' => round($compute['refund_price'],2),
//'refund_rate' => round($compute['refund_rate'],2),
'order_rate' => round($compute['order_rate'],2),
'order_extension' => round($compute['order_extension'],2),
'refund_extension' => round($compute['refund_extension'],2),
];
Db::transaction(function()use($order_ids,$refund_order_ids,$orderMake,$refundMake,$createData){
$res = $this->dao->create($createData);
$orderMake->updates($order_ids,['reconciliation_id' => $res['reconciliation_id']]);
$refundMake->updates($refund_order_ids,['reconciliation_id' => $res['reconciliation_id']]);
$this->reconciliationOrder($order_ids,$refund_order_ids,$res['reconciliation_id']);
SwooleTaskService::merchant('notice', [
'type' => 'accoubts',
'data'=>[
'title' => '新对账',
'message' => '您有一条新的对账单',
'id' => $res['reconciliation_id']
]
], $createData['mer_id']);
});
}
/**
* TODO 计算对账单金额
* @param $merId
* @param $order_ids
* @param $refund_order_ids
* @return array
* @author Qinii
* @day 2020-06-23
*/
public function compute($merId,$order_ids,$refund_order_ids)
{
$order_price = $refund_price = $order_extension = $refund_extension = $order_rate = $refund_rate =0;
$orderMake = app()->make(StoreOrderRepository::class);
$refundMake = app()->make(StoreRefundOrderRepository::class);
foreach($order_ids as $item){
if(!$order = $orderMake->getWhere(['order_id' => $item,'mer_id' => $merId,'paid' => 1]))
throw new ValidateException('订单信息不存在或状态错误');
if($order['reconciliation_id']) throw new ValidateException('订单重复提交');
//(实付金额 - 一级佣金 - 二级佣金) * 抽成
$commission_rate = ($order['commission_rate'] / 100);
//佣金
$_order_extension = bcadd($order['extension_one'],$order['extension_two'],3);
$order_extension = bcadd($order_extension,$_order_extension,3);
//手续费 = (实付金额 - 一级佣金 - 二级佣金) * 比例
$_order_rate = bcmul(bcsub($order['pay_price'],$_order_extension,3),$commission_rate,3);
$order_rate = bcadd($order_rate,$_order_rate,3);
//金额
$_order_price = bcsub(bcsub($order['pay_price'],$_order_extension,3),$_order_rate,3);
$order_price = bcadd($order_price,$_order_price,3);
}
foreach($refund_order_ids as $item){
if(!$refundOrder = $refundMake->getWhere(['refund_order_id' => $item,'mer_id' => $merId,'status' => 3],'*',['order']))
throw new ValidateException('退款订单信息不存在或状态错误');
if($refundOrder['reconciliation_id']) throw new ValidateException('退款订单重复提交');
//退款金额 + 一级佣金 + 二级佣金
$refund_commission_rate = ($refundOrder['order']['commission_rate'] / 100);
//佣金
$_refund_extension = bcadd($refundOrder['extension_one'],$refundOrder['extension_two'],3);
$refund_extension = bcadd($refund_extension,$_refund_extension,3);
//手续费
// $_refund_rate = bcmul(bcsub($refundOrder['refund_price'],$_refund_extension,3),$refund_commission_rate,3);
// $refund_rate = bcadd($refund_rate,$_refund_rate,3);
//金额
$_refund_price = bcadd($refundOrder['refund_price'],$_refund_extension,3);
$refund_price = bcadd($refund_price,$_refund_price,3);
}
$price = bcsub($order_price,$refund_price,3);
return compact('price','refund_price','order_extension','refund_extension','order_price','order_rate');
}
/**
* TODO
* @param $order_ids
* @param $refund_ids
* @param $reconciliation_id
* @return mixed
* @author Qinii
* @day 2020-06-23
*/
public function reconciliationOrder($order_ids,$refund_ids,$reconciliation_id)
{
$data = [];
foreach ($order_ids as $item){
$data[] = [
'order_id' => $item,
'reconciliation_id' => $reconciliation_id,
'type' => 0,
];
}
foreach ($refund_ids as $item) {
$data[] = [
'order_id' => $item,
'reconciliation_id' => $reconciliation_id,
'type' => 1,
];
}
return app()->make(MerchantReconciliationOrderRepository::class)->insertAll($data);
}
/**
* TODO 修改状态
* @param $id
* @param $data
* @param $type
* @author Qinii
* @day 2020-06-15
*/
public function switchStatus($id,$data)
{
Db::transaction(function()use($id,$data){
if(isset($data['status']) && $data['status'] == 1){
app()->make(StoreRefundOrderRepository::class)->reconciliationUpdate($id);
app()->make(StoreOrderRepository::class)->reconciliationUpdate($id);
}
$this->dao->update($id,$data);
});
$res = $this->dao->get($id);
$mer = app()->make(SupplyRepository::class)->get($res['mer_id']);
if(isset($data['is_accounts']) && $data['is_accounts']){
// $make = app()->make(FinancialRecordRepository::class);
//
// $make->dec([
// 'order_id' => $id,
// 'order_sn' => $id,
// 'user_info' => $mer['mer_name'],
// 'user_id' => $res['mer_id'],
// 'financial_type' => 'sys_accoubts',
// 'number' => $res->price,
// ],0);
//
// $make->inc([
// 'order_id' => $id,
// 'order_sn' => $id,
// 'user_info' => '总平台',
// 'user_id' => 0,
// 'financial_type' => 'mer_accoubts',
// 'number' => $res->price,
// ],$res->mer_id);
SwooleTaskService::merchant('notice', [
'type' => 'accoubts',
'data'=>[
'title' => '新对账打款',
'message' => '您有一条新对账打款通知',
'id' => $id
]
], $res['mer_id']);
}
}
public function markForm($id)
{
$data = $this->dao->get($id);
$form = Elm::createForm(Route::buildUrl('merchantReconciliationMark', ['id' => $id])->build());
$form->setRule([
Elm::text('mark', '备注:',$data['mark'])->placeholder('请输入备注')->required(),
]);
return $form->setTitle('修改备注');
}
public function adminMarkForm($id)
{
$data = $this->dao->get($id);
$form = Elm::createForm(Route::buildUrl('systemMerchantReconciliationMark', ['id' => $id])->build());
$form->setRule([
Elm::text('admin_mark', '备注:',$data['admin_mark'])->placeholder('请输入备注')->required(),
]);
return $form->setTitle('修改备注');
}
}

View File

@ -0,0 +1,146 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\common\repositories\user;
use app\common\dao\user\UserSupplyDao;
use app\common\repositories\BaseRepository;
use app\common\repositories\system\config\ConfigValueRepository;
use FormBuilder\Factory\Elm;
use think\facade\Db;
use think\facade\Route;
/**
* Class UserSupplyRepository
* @package app\common\repositories\user
* @author xaboy
* @day 2020/10/20
* @mixin UserSupplyDao
*/
class UserSupplyRepository extends BaseRepository
{
/**
* UserSupplyRepository constructor.
* @param UserSupplyDao $dao
*/
public function __construct(UserSupplyDao $dao)
{
$this->dao = $dao;
}
public function getList(array $where, $page, $limit)
{
// 获取默认头像
$user_default_avatar = app()->make(ConfigValueRepository::class)->get('user_default_avatar', 0);
$query = $this->dao->search($where);
$count = $query->count();
$make = app()->make(UserLabelRepository::class);
$list = $query->setOption('field', [])->field('A.uid,A.user_merchant_id,B.avatar,B.nickname,B.user_type,A.last_pay_time,A.first_pay_time,A.label_id,A.create_time,A.last_time,A.pay_num,A.pay_price,B.phone,B.is_svip,B.svip_endtime')
->page($page, $limit)->order('A.user_merchant_id DESC')->select()
->each(function ($item) use ($where, $make, $user_default_avatar) {
if (env('SHOW_PHONE',false) && $item->phone && is_numeric($item->phone)){
if (app('request')->userType() !== 2 || app('request')->adminInfo()['level'] != 0) {
$item->phone = substr_replace($item->phone, '****', 3, 4);
}
}
$item->label = count($item['label_id']) ? $make->labels($item['label_id'], $where['mer_id']) : [];
//$item->svip_endtime = date('Y-m-d H:i:s', strtotime("+100 year"));
if (empty($item->avatar)) {
return $item->avatar = $user_default_avatar;
}
return $item;
});
return compact('count', 'list');
}
/**
* @param $uid
* @param $merId
* @return \app\common\dao\BaseDao|\think\Model
* @author xaboy
* @day 2020/10/20
*/
public function create($uid, $merId)
{
return $this->dao->create([
'uid' => $uid,
'mer_id' => $merId,
]);
}
/**
* @param $uid
* @param $mer_id
* @return \app\common\dao\BaseDao|array|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author xaboy
* @day 2020/10/20
*/
public function getInfo($uid, $mer_id)
{
$user = $this->dao->getWhere(compact('uid', 'mer_id'));
if (!$user) $user = $this->create($uid, $mer_id);
return $user;
}
/**
* @param $uid
* @param $merId
* @param $pay_price
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author xaboy
* @day 2020/10/21
*/
public function updatePayTime($uid, $merId, $pay_price, $flag = true)
{
$user = $this->getInfo($uid, $merId);
$time = date('Y-m-d H:i:s');
$user->last_pay_time = $time;
if ($flag)
$user->pay_num++;
$user->pay_price = bcadd($user->pay_price, $pay_price, 2);
if (!$user->first_pay_time) $user->first_pay_time = $time;
$user->save();
}
public function rmLabel($id)
{
return $this->dao->search(['label_id' => $id])->update([
'A.label_id' => Db::raw('(trim(BOTH \',\' FROM replace(CONCAT(\',\',A.label_id,\',\'),\',' . $id . ',\',\',\')))')
]);
}
public function changeLabelForm($merId, $id)
{
$user = $this->dao->get($id);
/** @var UserLabelRepository $make */
$userLabelRepository = app()->make(UserLabelRepository::class);
$data = $userLabelRepository->allOptions($merId);
return Elm::createForm(Route::buildUrl('merchantUserChangeLabel', compact('id'))->build(), [
Elm::selectMultiple('label_id', '用户标签:', $userLabelRepository->intersection($user->label_id, $merId, 0))->options(function () use ($data) {
$options = [];
foreach ($data as $value => $label) {
$options[] = compact('value', 'label');
}
return $options;
})
])->setTitle('修改用户标签');
}
}

View File

@ -0,0 +1,297 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\controller\supply;
use app\common\repositories\system\CountRepository;
use app\common\repositories\user\UserRepository;
use crmeb\basic\BaseController;
use app\common\repositories\store\order\StoreOrderProductRepository;
use app\common\repositories\store\order\StoreOrderRepository;
use app\common\repositories\store\product\ProductRepository;
use app\common\repositories\user\UserRelationRepository;
use app\common\repositories\user\UserVisitRepository;
use crmeb\services\ImageWaterMarkService;
use crmeb\services\UploadService;
use think\App;
use think\facade\Cache;
/**
* Class Common
* @package app\controller\supply
* @author xaboy
* @day 2020/6/25
*/
class Common extends BaseController
{
/**
* @var int|null
*/
protected $merId;
/**
* Common constructor.
* @param App $app
*/
public function __construct(App $app)
{
parent::__construct($app);
$this->merId = $this->request->merId() ?: null;
}
/**
* @param null $merId
* @return mixed
* @author xaboy
* @day 2020/6/25
*/
public function main($merId = null)
{
$today = $this->mainGroup('today', $merId ?? $this->merId);
$yesterday = $this->mainGroup('yesterday', $merId ?? $this->merId);
$lastWeek = $this->mainGroup(date('Y-m-d', strtotime('- 7day')), $merId ?? $this->merId);
$lastWeekRate = [];
foreach ($lastWeek as $k => $item) {
if ($item == $today[$k])
$lastWeekRate[$k] = 0;
else if ($item == 0)
$lastWeekRate[$k] = $today[$k];
else if ($today[$k] == 0)
$lastWeekRate[$k] = -$item;
else
$lastWeekRate[$k] = (float)bcdiv(bcsub($today[$k], $item, 4), $item, 4);
}
$day = date('Y-m-d');
return $merId ? compact('today', 'yesterday', 'lastWeekRate', 'day') : app('json')->success(compact('today', 'yesterday', 'lastWeekRate', 'day'));
}
/**
* @param $date
* @param $merId
* @return array
* @author xaboy
* @day 2020/6/25
*/
public function mainGroup($date, $merId)
{
$userVisitRepository = app()->make(UserVisitRepository::class);
$repository = app()->make(StoreOrderRepository::class);
$relationRepository = app()->make(UserRelationRepository::class);
$orderNum = (float)$repository->dayOrderNum($date, $merId);
$payPrice = (float)$repository->dayOrderPrice($date, $merId);
$payUser = (float)$repository->dayOrderUserNum($date, $merId);
$visitNum = (float)$userVisitRepository->dateVisitUserNum($date, $merId);
$likeStore = (float)$relationRepository->dayLikeStore($date, $merId);
return compact('orderNum', 'payPrice', 'payUser', 'visitNum', 'likeStore');
}
/**
* @param StoreOrderRepository $repository
* @return mixed
* @author xaboy
* @day 2020/6/25
*/
public function order(StoreOrderRepository $repository)
{
$date = $this->request->param('date') ?: 'lately7';
$res = Cache::remember(self::class . '@order' . $this->merId . $date, function () use ($repository, $date) {
if ($date == 'year') {
$m = date('m', time());
$time[] = $m;
do {
$time[] = '0' . ($m - 1);
$m--;
} while ($m > 1);
$time = array_reverse($time);
} else {
$time = getDatesBetweenTwoDays(getStartModelTime($date), date('Y-m-d'));
}
$list = $repository->orderGroupNum($date, $this->merId)->toArray();
$list = array_combine(array_column($list, 'day'), $list);
$data = [];
foreach ($time as $item) {
$data[] = [
'day' => $item,
'total' => $list[$item]['total'] ?? 0,
'user' => $list[$item]['user'] ?? 0,
'pay_price' => $list[$item]['pay_price'] ?? 0
];
}
return $data;
}, 2000 + random_int(600, 1200));
return app('json')->success($res);
}
/**
* @param UserRelationRepository $repository
* @param StoreOrderRepository $orderRepository
* @param UserVisitRepository $userVisitRepository
* @return \think\response\Json
* @author xaboy
* @day 2020/9/24
*/
public function user(StoreOrderRepository $orderRepository, UserVisitRepository $userVisitRepository)
{
$date = $this->request->param('date', 'today') ?: 'today';
$res = Cache::store('file')->remember(self::class . '@user' . $this->merId . $date, function () use ($orderRepository, $userVisitRepository, $date) {
$visitUser = $userVisitRepository->dateVisitUserNum($date, $this->merId);
$orderUser = $orderRepository->orderUserNum($date, null, $this->merId);
$orderPrice = $orderRepository->orderPrice($date, null, $this->merId);
$payOrderUser = $orderRepository->orderUserNum($date, 1, $this->merId);
$payOrderPrice = $orderRepository->orderPrice($date, 1, $this->merId);
$userRate = $payOrderUser ? bcdiv($payOrderPrice, $payOrderUser, 2) : 0;
$orderRate = $visitUser ? bcdiv($orderUser, $visitUser, 2) : 0;
$payOrderRate = $orderUser ? bcdiv($payOrderUser, $orderUser, 2) : 0;
return compact('visitUser', 'orderUser', 'orderPrice', 'payOrderUser', 'payOrderPrice', 'payOrderRate', 'userRate', 'orderRate');
}, 2000 + random_int(600, 1200));
return app('json')->success($res);
}
/**
* @param StoreOrderRepository $repository
* @return mixed
* @author xaboy
* @day 2020/6/25
*/
public function userRate(StoreOrderRepository $repository, UserRepository $userRepository)
{
$date = $this->request->param('date') ?: 'today';
$res = Cache::store('file')->remember(self::class . '@userRate' . $this->merId . $date, function () use ($userRepository, $repository, $date) {
$uids = $repository->orderUserGroup($date, 1, $this->merId)->toArray();
$userPayCount = $userRepository->idsByPayCount(array_column($uids, 'uid'));
$user = count($uids);
$oldUser = 0;
$totalPrice = 0;
$oldTotalPrice = 0;
foreach ($uids as $uid) {
$totalPrice = bcadd($uid['pay_price'], $totalPrice, 2);
if (($userPayCount[$uid['uid']] ?? 0) > $uid['total']) {
$oldUser++;
$oldTotalPrice = bcadd($uid['pay_price'], $oldTotalPrice, 2);
}
}
$newTotalPrice = bcsub($totalPrice, $oldTotalPrice, 2);
$newUser = $user - $oldUser;
return compact('newTotalPrice', 'newUser', 'oldTotalPrice', 'oldUser', 'totalPrice', 'user');
}, 2000 + random_int(600, 1200));
return app('json')->success($res);
}
/**
* @param StoreOrderProductRepository $repository
* @return mixed
* @author xaboy
* @day 2020/6/25
*/
public function product(StoreOrderProductRepository $repository)
{
$date = $this->request->param('date', 'today') ?: 'today';
$res = Cache::store('file')->remember(self::class . '@product' . $this->merId . $date, function () use ($repository, $date) {
return $repository->orderProductGroup($date, $this->merId)->toArray();
}, 2000 + random_int(600, 1200));
return app('json')->success($res);
}
public function productVisit(UserVisitRepository $repository)
{
$date = $this->request->param('date', 'today') ?: 'today';
$res = Cache::store('file')->remember(self::class . '@productVisit' . $this->merId . $date, function () use ($repository, $date) {
return $repository->dateVisitProductNum($date, $this->merId);
}, 2000 + random_int(600, 1200));
return app('json')->success($res);
}
/**
* @param ProductRepository $repository
* @return mixed
* @author xaboy
* @day 2020/6/25
*/
public function productCart(ProductRepository $repository)
{
$date = $this->request->param('date', 'today') ?: 'today';
$res = Cache::store('file')->remember(self::class . '@productCart' . $this->merId . $date, function () use ($repository, $date) {
return $repository->cartProductGroup($date, $this->merId);
}, 2000 + random_int(600, 1200));
return app('json')->success($res);
}
public function uploadCertificate()
{
$file = $this->request->file('file');
if (!$file)
return app('json')->fail('请上传证书');
validate(["file|图片" => [
'fileSize' => config('upload.filesize'),
'fileExt' => 'jpg,jpeg,png,bmp',
'fileMime' => 'image/jpeg,image/png',
]])->check(['file' => $file]);
$upload = UploadService::create(1);
$data = $upload->to('attach')->move('file');
if ($data === false) {
return app('json')->fail($upload->getError());
}
app()->make(ImageWaterMarkService::class)->run(public_path() . $upload->getFileInfo()->filePath);
return app('json')->success(['src' => tidy_url($upload->getFileInfo()->filePath)]);
}
public function uploadVideo()
{
$file = $this->request->file('file');
if (!$file)
return app('json')->fail('请上传视频');
validate(["file|视频" => [
'fileSize' => config('upload.filesize'),
'fileExt' => 'mp4,mov',
'fileMime' => 'video/mp4,video/quicktime',
]])->check(['file' => $file]);
$upload = UploadService::create();
$data = $upload->to('media')->validate([])->move('file');
if ($data === false) {
return app('json')->fail($upload->getError());
}
return app('json')->success(['src' => tidy_url($upload->getFileInfo()->filePath)]);
}
public function config()
{
$data = systemConfig(['tx_map_key', 'delivery_status', 'delivery_type', 'rmargin_emind_switch']);
$data['mer_id'] = $this->request->merId();
return app('json')->success($data);
}
public function getMerchantCount()
{
return app('json')->success(app()->make(CountRepository::class)->getMerchantCount($this->request->merId()));
}
public function getMerchantTodo()
{
return app('json')->success(app()->make(CountRepository::class)->getMerchantTodo($this->request->merId()));
}
public function getProductSalesPriceTop()
{
$date = $this->request->param('date') ?: 'lately7';
return app('json')->success(app()->make(CountRepository::class)->getMerchantProductSalesPriceTop($this->request->merId(), $date));
}
}

View File

@ -0,0 +1,80 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store;
use app\common\repositories\store\ExcelRepository;
use crmeb\exceptions\UploadException;
use crmeb\services\ExcelService;
use think\App;
use crmeb\basic\BaseController;
class Excel extends BaseController
{
protected $repository;
public function __construct(App $app, ExcelRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
/**
* TODO
* @return mixed
* @author Qinii
* @day 2020-08-15
*/
public function lst()
{
$admin = $this->request->adminInfo();
if($admin['level']) $where['admin_id'] = $this->request->adminId();
[$page, $limit] = $this->getPage();
$where['type'] = $this->request->param('type','');
$where['mer_id'] = $this->request->merId();
$data = $this->repository->getList($where,$page,$limit);
return app('json')->success($data);
}
/**
* TODO 下载文件
* @param $id
* @return \think\response\File
* @author Qinii
* @day 2020-07-30
*/
public function downloadExpress()
{
try{
$file['name'] = 'express';
$path = app()->getRootPath().'extend/express.xlsx';
if(!$file || !file_exists($path)) return app('json')->fail('文件不存在');
return download($path,$file['name']);
}catch (UploadException $e){
return app('json')->fail('下载失败');
}
}
/**
* TODO 所有类型
* @return \think\response\Json
* @author Qinii
* @day 7/2/21
*/
public function type()
{
$data = $this->repository->getTypeData();
return app('json')->success($data);
}
}

View File

@ -0,0 +1,134 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store;
use crmeb\basic\BaseController;
use app\common\repositories\store\StoreAttrTemplateRepository;
use app\validate\supply\StoreAttrTemplateValidate;
use think\App;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
/**
* Class StoreAttrTemplate
* @package app\controller\supply\store
* @author xaboy
* @day 2020-05-06
*/
class StoreAttrTemplate extends BaseController
{
/**
* @var StoreAttrTemplateRepository
*/
protected $repository;
/**
* StoreAttrTemplate constructor.
* @param App $app
* @param StoreAttrTemplateRepository $repository
*/
public function __construct(App $app, StoreAttrTemplateRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
/**
* @return mixed
* @throws DbException
* @throws DataNotFoundException
* @throws ModelNotFoundException
* @author xaboy
* @day 2020-05-06
*/
public function lst()
{
[$page, $limit] = $this->getPage();
$data = $this->repository->getList($this->request->merId(), [], $page, $limit);
return app('json')->success($data);
}
public function getlist()
{
return app('json')->success($this->repository->list($this->request->merId()));
}
/**
* @param StoreAttrTemplateValidate $validate
* @return mixed
* @author xaboy
* @day 2020-05-06
*/
public function create(StoreAttrTemplateValidate $validate)
{
$data = $this->checkParams($validate);
$data['mer_id'] = $this->request->merId();
$this->repository->create($data);
return app('json')->success('添加成功');
}
/**
* @param $id
* @param StoreAttrTemplateValidate $validate
* @return mixed
* @throws DbException
* @author xaboy
* @day 2020-05-06
*/
public function update($id, StoreAttrTemplateValidate $validate)
{
$merId = $this->request->merId();
if (!$this->repository->merExists($merId, $id))
return app('json')->fail('数据不存在');
$data = $this->checkParams($validate);
$data['mer_id'] = $merId;
$this->repository->update($id, $data);
return app('json')->success('编辑成功');
}
/**
* @param $id
* @return mixed
* @throws DbException
* @author xaboy
* @day 2020-05-06
*/
public function delete($id)
{
$merId = $this->request->merId();
if (!$this->repository->merExists($merId, $id))
return app('json')->fail('数据不存在');
$this->repository->delete($id, $merId);
return app('json')->success('删除成功');
}
/**
* @param StoreAttrTemplateValidate $validate
* @return array
* @author xaboy
* @day 2020-05-06
*/
public function checkParams(StoreAttrTemplateValidate $validate)
{
$data = $this->request->params(['template_name', ['template_value', []]]);
$validate->check($data);
return $data;
}
}

View File

@ -0,0 +1,118 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store;
use app\common\repositories\store\order\StoreImportDeliveryRepository;
use crmeb\jobs\ImportSpreadsheetExcelJob;
use crmeb\services\ExcelService;
use crmeb\services\SpreadsheetExcelService;
use crmeb\services\UploadService;
use think\App;
use crmeb\basic\BaseController;
use app\common\repositories\store\order\StoreImportRepository;
use think\facade\Queue;
class StoreImport extends BaseController
{
protected $repository;
/**
* Product constructor.
* @param App $app
* @param StoreImportRepository $repository
*/
public function __construct(App $app, StoreImportRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
public function lst()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['status','date',['import_type','delivery'],'type']);
$where['mer_id'] = $this->request->merId();
$data = $this->repository->getList($where,$page,$limit);
return app('json')->success($data);
}
public function detail($id)
{
$where = [
'import_id' => $id,
'mer_id' => $this->request->merId()
];
[$page, $limit] = $this->getPage();
$data = app()->make(StoreImportDeliveryRepository::class)->getList($where,$page, $limit);
return app('json')->success($data);
}
public function export($id)
{
$where = [
'import_id' => $id,
'mer_id' => $this->request->merId()
];
[$page, $limit] = $this->getPage();
$data = app()->make(ExcelService::class)->importDelivery($where, $page, $limit);
return app('json')->success($data);
}
/**
* TODO 导入excel信息
* @return \think\response\Json
* @author Qinii
* @day 3/16/21
*/
public function Import($type)
{
$file = $this->request->file('file');
if (!$file) return app('json')->fail('请上传EXCEL文件');
$file = is_array($file) ? $file[0] : $file;
validate(["file|文件" => ['fileExt' => 'xlsx,xls',]])->check(['file' => $file]);
$upload = UploadService::create(1);
$ret = $upload->to('excel')->move('file');
if ($ret === false) return app('json')->fail($upload->getError());
$res = $upload->getUploadInfo();
$path = rtrim(public_path(),'/').$res['dir'];
$data = [];
switch ($type){
case 'delivery' :
SpreadsheetExcelService::instance()->checkImport($path,['E3' => '物流单号']);
$data = [
'mer_id' => $this->request->merId(),
'data' => [
'path' => $path,
'sql' => ['delivery_name' => 'D', 'delivery_id' => 'E',],
'where' => ['order_sn' => 'B',],
]
];
break;
default:
$data = SpreadsheetExcelService::instance()->_import($path,[],[],0);
break;
}
if(!empty($data)){
$res = $this->repository->create($this->request->merId(),'delivery');
$data['data']['import_id'] = $res->import_id;
// app()->make(StoreOrderRepository::class)->setWhereDeliveryStatus($data['data'],$data['mer_id']);
Queue::push(ImportSpreadsheetExcelJob::class,$data);
return app('json')->success('开始导入数据,请稍后在批量发货记录中查看!');
}
return app('json')->fail('数据类型错误');
}
}

View File

@ -0,0 +1,119 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store;
use app\common\repositories\store\StorePrinterRepository;
use think\App;
use crmeb\basic\BaseController;
class StorePrinter extends BaseController
{
protected $repository;
public function __construct(App $app, StorePrinterRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
/**
* TODO
* @return mixed
* @author Qinii
* @day 2020-08-15
*/
public function lst()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['status','keyword']);
$where['mer_id'] = $this->request->merId();
$data = $this->repository->merList($where,$page,$limit);
return app('json')->success($data);
}
public function createForm()
{
return app('json')->success(formToData($this->repository->form(null)));
}
public function create()
{
$params = $this->request->params([
'type',
'printer_name',
'printer_appkey',
'printer_appid',
'printer_secret',
'printer_terminal',
'status',
]);
if (!$params['printer_name'] ||
!$params['printer_appid'] ||
!$params['printer_appkey'] ||
!$params['printer_terminal']
) {
return app('json')->fail('信息不完整');
}
$params['mer_id'] = $this->request->merId();
$this->repository->create($params);
return app('json')->success('添加成功');
}
public function updateForm($id)
{
return app('json')->success(formToData($this->repository->form($id)));
}
public function update($id)
{
$params = $this->request->params([
'type',
'printer_name',
'printer_appkey',
'printer_appid',
'printer_secret',
'printer_terminal',
'status',
]);
if (!$params['printer_name'] ||
!$params['printer_appid'] ||
!$params['printer_appkey'] ||
!$params['printer_terminal']
) {
return app('json')->fail('信息不完整');
}
$res = $this->repository->getWhere(['printer_id' => $id, 'mer_id' => $this->request->merId()]);
if (!$res) return app('json')->fail('打印机信息不存在');
$this->repository->update($id, $params);
return app('json')->success('添加成功');
}
public function delete($id)
{
$res = $this->repository->getWhere(['printer_id' => $id, 'mer_id' => $this->request->merId()]);
if (!$res) return app('json')->fail('打印机信息不存在');
$this->repository->delete($id);
return app('json')->success('删除成功');
}
public function switchWithStatus($id)
{
$status = $this->request->param('status') == 1 ? 1 : 0;
$this->repository->update($id,['status' => $status]);
return app('json')->success('修改成功');
}
}

View File

@ -0,0 +1,42 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store;
use app\common\repositories\store\product\ProductReplyRepository;
use crmeb\basic\BaseController;
use think\App;
class StoreProductReply extends BaseController
{
protected $repository;
public function __construct(App $app, ProductReplyRepository $replyRepository)
{
parent::__construct($app);
$this->repository = $replyRepository;
}
public function changeSort($id)
{
$merId = $this->request->merId();
if (!$this->repository->merExists($merId, $id))
return app('json')->fail('数据不存在');
$sort = (int)$this->request->param('sort');
$this->repository->update($id, compact('sort'));
return app('json')->success('修改成功');
}
}

View File

@ -0,0 +1,84 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\broadcast;
use app\common\repositories\store\broadcast\BroadcastAssistantRepository;
use crmeb\basic\BaseController;
use think\App;
use think\exception\ValidateException;
class BroadcastAssistant extends BaseController
{
protected $repository;
public function __construct(App $app, BroadcastAssistantRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
public function lst()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['username', 'nickname']);
$where['mer_id'] = $this->request->merId();
return app('json')->success($this->repository->getList($where, $page, $limit));
}
public function createForm()
{
return app('json')->success(formToData($this->repository->form(null)));
}
public function updateForm($id)
{
if (!$this->repository->merExists($id, $this->request->merId()))
return app('json')->fail('数据不存在');
return app('json')->success(formToData($this->repository->form(intval($id))));
}
public function create()
{
$data = $this->checkParams();
$data['mer_id'] = $this->request->merId();
$this->repository->create($data);
return app('json')->success('添加成功');
}
public function update($id)
{
if (!$this->repository->merExists($id, $this->request->merId()))
return app('json')->fail('数据不存在');
$this->repository->update($id, $this->checkParams());
return app('json')->success('修改成功');
}
public function checkParams()
{
$data = $this->request->params(['username', 'nickname', 'mark']);
if (!$data['username'] || !$data['nickname']) {
throw new ValidateException('微信号或昵称不可为空');
}
return $data;
}
public function delete($id)
{
if (!$this->repository->merExists($id, $this->request->merId()))
return app('json')->fail('数据不存在');
$this->repository->delete((int)$id);
return app('json')->success('删除成功');
}
}

View File

@ -0,0 +1,118 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\broadcast;
use app\common\repositories\store\broadcast\BroadcastGoodsRepository;
use app\validate\supply\BroadcastGoodsValidate;
use crmeb\basic\BaseController;
use think\App;
class BroadcastGoods extends BaseController
{
protected $repository;
public function __construct(App $app, BroadcastGoodsRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
public function lst()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['status_tag', 'keyword', 'mer_valid','broadcast_goods_id']);
return app('json')->success($this->repository->getList($this->request->merId(), $where, $page, $limit));
}
public function detail($id)
{
if (!$this->repository->merExists($id, $this->request->merId()))
return app('json')->fail('数据不存在');
return app('json')->success($this->repository->get($id)->append(['product'])->toArray());
}
public function createForm()
{
return app('json')->success(formToData($this->repository->createForm()));
}
protected function checkParams(BroadcastGoodsValidate $validate)
{
$data = $this->request->params(['name', 'cover_img', 'product_id', 'price']);
$validate->check($data);
$data['product_id'] = $data['product_id']['id'];
return $data;
}
public function create(BroadcastGoodsValidate $validate)
{
$this->repository->create($this->request->merId(), $this->checkParams($validate));
return app('json')->success('创建成功');
}
public function batchCreate(BroadcastGoodsValidate $validate)
{
$goods = $this->request->param('goods', []);
if (!count($goods)) return app('json')->fail('请选中商品');
$validate->isBatch();
foreach ($goods as $item) {
$validate->check((array)$item);
}
$this->repository->batchCreate($this->request->merId(), $goods);
return app('json')->success('创建成功');
}
public function updateForm($id)
{
if (!$this->repository->merExists($id, $this->request->merId()))
return app('json')->fail('数据不存在');
return app('json')->success(formToData($this->repository->updateForm($id)));
}
public function update($id, BroadcastGoodsValidate $validate)
{
if (!$this->repository->merExists($id, $this->request->merId()))
return app('json')->fail('数据不存在');
$this->repository->update($id, $this->checkParams($validate));
return app('json')->success('编辑成功');
}
public function mark($id)
{
$mark = (string)$this->request->param('mark');
if (!$this->repository->merExists($id, $this->request->merId()))
return app('json')->fail('数据不存在');
$this->repository->mark($id, $mark);
return app('json')->success('修改成功');
}
public function changeStatus($id)
{
$isShow = $this->request->param('is_show') == 1 ? 1 : 0;
if (!$this->repository->merExists($id, $this->request->merId()))
return app('json')->fail('数据不存在');
$this->repository->isShow($id, $isShow);
return app('json')->success('修改成功');
}
public function delete($id)
{
if (!$this->repository->merExists($id, $this->request->merId()))
return app('json')->fail('数据不存在');
$this->repository->delete((int)$id);
return app('json')->success('删除成功');
}
}

View File

@ -0,0 +1,196 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\broadcast;
use app\common\repositories\store\broadcast\BroadcastAssistantRepository;
use app\common\repositories\store\broadcast\BroadcastRoomGoodsRepository;
use app\common\repositories\store\broadcast\BroadcastRoomRepository;
use app\validate\supply\BroadcastRoomValidate;
use crmeb\basic\BaseController;
use think\App;
class BroadcastRoom extends BaseController
{
protected $repository;
public function __construct(App $app, BroadcastRoomRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
public function lst()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['keyword', 'status_tag', 'show_tag', 'show_type','live_status','broadcast_room_id']);
return app('json')->success($this->repository->getList($this->request->merId(), $where, $page, $limit));
}
/**
* @param BroadcastRoomGoodsRepository $repository
* @param $id
* @return \think\response\Json
* @author xaboy
* @day 2020/8/31
*/
public function goodsList(BroadcastRoomGoodsRepository $repository, $id)
{
[$page, $limit] = $this->getPage();
if (!$this->repository->merExists((int)$id, $this->request->merId()))
return app('json')->fail('直播间不存在');
return app('json')->success($repository->getGoodsList($id, $page, $limit));
}
public function detail($id)
{
if (!$this->repository->merExists($id, $this->request->merId()))
return app('json')->fail('数据不存在');
return app('json')->success($this->repository->get($id)->toArray());
}
public function createForm()
{
return app('json')->success(formToData($this->repository->createForm()));
}
public function updateForm($id)
{
if (!$this->repository->merExists($id, $this->request->merId()))
return app('json')->fail('数据不存在');
if (!$this->repository->existsWhere(['broadcast_room_id' => $id, 'status' => [-1, 0]]))
return app('json')->fail('当前直播间不能修改');
return app('json')->success(formToData($this->repository->updateForm(intval($id))));
}
public function create()
{
$this->repository->create($this->request->merId(), $this->checkParams());
return app('json')->success('创建成功');
}
public function update($id)
{
if (!$this->repository->merExists($id, $this->request->merId()))
return app('json')->fail('数据不存在');
if (!$this->repository->existsWhere(['broadcast_room_id' => $id, 'status' => [-1, 0]]))
return app('json')->fail('当前直播间不能修改');
$this->repository->updateRoom($this->request->merId(), $id, $this->checkParams());
return app('json')->success('修改成功');
}
public function checkParams()
{
$validate = app()->make(BroadcastRoomValidate::class);
$data = $this->request->params(['name', 'cover_img', 'share_img', 'anchor_name', 'anchor_wechat', 'phone', 'start_time', 'type', 'screen_type', 'close_like', 'close_goods', 'close_comment', 'replay_status', 'close_share', 'close_kf','feeds_img','is_feeds_public']);
$validate->check($data);
[$data['start_time'], $data['end_time']] = $data['start_time'];
return $data;
}
public function changeStatus($id)
{
$isShow = $this->request->param('is_show') == 1 ? 1 : 0;
if (!$this->repository->merExists($id, $this->request->merId()))
return app('json')->fail('数据不存在');
$this->repository->isShow($id, $isShow);
return app('json')->success('修改成功');
}
public function mark($id)
{
$mark = (string)$this->request->param('mark');
if (!$this->repository->merExists($id, $this->request->merId()))
return app('json')->fail('数据不存在');
$this->repository->mark($id, $mark);
return app('json')->success('修改成功');
}
public function exportGoods()
{
[$ids, $roomId] = $this->request->params(['ids', 'room_id'], true);
if (!count($ids)) return app('json')->fail('请选择直播商品');
$this->repository->exportGoods($this->request->merId(), (array)$ids, $roomId);
return app('json')->success('导入成功');
}
public function rmExportGoods()
{
[$id, $roomId] = $this->request->params(['id', 'room_id'], true);
$this->repository->rmExportGoods($this->request->merId(), intval($roomId), intval($id));
return app('json')->success('删除成功');
}
public function delete($id)
{
if (!$this->repository->merExists($id, $this->request->merId()))
return app('json')->fail('数据不存在');
$this->repository->merDelete((int)$id);
return app('json')->success('删除成功');
}
public function addAssistantForm($id)
{
return app('json')->success(formToData($this->repository->assistantForm($id, $this->request->merId())));
}
public function addAssistant($id)
{
$data = $this->request->param('assistant_id');
$make = app()->make(BroadcastAssistantRepository::class);
foreach ($data as $datum) {
$has = $make->exists($datum);
if (!$has) return app('json')->fail('助手信息不存在,ID:'.$datum);
}
$this->repository->editAssistant($id, $this->request->merId(), $data);
return app('json')->success('修改成功');
}
public function pushMessage($id)
{
if (!$this->repository->merExists($id, $this->request->merId()))
return app('json')->fail('数据不存在');
$this->repository->pushMessage($id);
return app('json')->success('消息已发送');
}
public function closeKf($id)
{
$status = $this->request->param('status') == 1 ? 1 : 0;
$this->repository->closeInfo($id,'close_kf', $status);
return app('json')->success('修改成功');
}
public function banComment($id)
{
$status = $this->request->param('status') == 1 ? 1 : 0;
$this->repository->closeInfo($id,'close_comment', $status);
return app('json')->success('修改成功');
}
public function isFeedsPublic($id)
{
$status = $this->request->param('status') == 1 ? 1 : 0;
$this->repository->closeInfo($id,'is_feeds_public', $status);
return app('json')->success('修改成功');
}
public function onSale($id)
{
$status = $this->request->param('status') == 1 ? 1 : 0;
$data['goods_id'] =$this->request->param('goods_id');
$this->repository->closeInfo($id,'on_sale', $status,false,$data);
return app('json')->success('修改成功');
}
}

View File

@ -0,0 +1,238 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\coupon;
use app\common\repositories\store\coupon\StoreCouponSendRepository;
use app\validate\supply\StoreCouponSendValidate;
use crmeb\basic\BaseController;
use app\common\repositories\store\coupon\StoreCouponRepository;
use app\common\repositories\store\coupon\StoreCouponUserRepository;
use app\validate\supply\StoreCouponValidate;
use FormBuilder\Exception\FormBuilderException;
use think\App;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\exception\ValidateException;
/**
* Class CouponIssue
* @package app\controller\supply\store\coupon
* @author xaboy
* @day 2020-05-13
*/
class Coupon extends BaseController
{
/**
* @var StoreCouponRepository
*/
protected $repository;
/**
* CouponIssue constructor.
* @param App $app
* @param StoreCouponRepository $repository
*/
public function __construct(App $app, StoreCouponRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
/**
* @return mixed
* @throws DbException
* @throws DataNotFoundException
* @throws ModelNotFoundException
* @author xaboy
* @day 2020-05-14
*/
public function lst()
{
$where = $this->request->params(['is_full_give', 'status', 'is_give_subscribe', 'coupon_name', 'send_type', 'type']);
[$page, $limit] = $this->getPage();
return app('json')->success($this->repository->getList($this->request->merId(), $where, $page, $limit));
}
public function detail($id)
{
if (!$this->repository->merExists($this->request->merId(), $id))
return app('json')->fail('数据不存在');
$coupon = $this->repository->get($id)->append(['used_num', 'send_num']);
return app('json')->success($coupon->toArray());
}
/**
* @return mixed
* @throws FormBuilderException
* @author xaboy
* @day 2020-05-13
*/
public function createForm()
{
return app('json')->success(formToData($this->repository->form()));
}
/**
* @param StoreCouponValidate $validate
* @return mixed
* @author xaboy
* @day 2020/5/30
*/
public function create(StoreCouponValidate $validate)
{
$merId = $this->request->merId();
$data = $this->checkParams($validate);
$data['mer_id'] = $merId;
$this->repository->create($data);
return app('json')->success('发布成功');
}
/**
* @param StoreCouponValidate $validate
* @return array
* @author xaboy
* @day 2020/5/20
*/
public function checkParams(StoreCouponValidate $validate)
{
$data = $this->request->params(['use_type', 'title', 'coupon_price', 'use_min_price', 'coupon_type', 'coupon_time', ['use_start_time', []], 'sort', ['status', 0], 'type', ['product_id', []], ['range_date', ''], ['send_type', 0], ['full_reduction', 0], ['is_limited', 0], ['is_timeout', 0], ['total_count', ''], ['status', 0]]);
$validate->check($data);
if ($data['is_timeout']) {
[$data['start_time'], $data['end_time']] = $data['range_date'];
if (strtotime($data['end_time']) <= time())
throw new ValidateException('优惠券领取结束时间不能小于当前');
}
if (!$data['use_type']) $data['use_min_price'] = 0;
unset($data['use_type']);
if ($data['coupon_type']) {
if (count(array_filter($data['use_start_time'])) != 2)
throw new ValidateException('请选择有效期限');
[$data['use_start_time'], $data['use_end_time']] = $data['use_start_time'];
} else unset($data['use_start_time']);
unset($data['range_date']);
if ($data['is_limited'] == 0) $data['total_count'] = 0;
if (!in_array($data['type'], [0, 1, 2])) {
throw new ValidateException('请选择有效的优惠券类型');
}
return $data;
}
/**
* @param $id
* @return mixed
* @throws DbException
* @author xaboy
* @day 2020-05-13
*/
public function changeStatus($id)
{
$status = $this->request->param('status', 0) == 1 ? 1 : 0;
if (!$this->repository->merExists($this->request->merId(), $id))
return app('json')->fail('数据不存在');
$this->repository->update($id, compact('status'));
return app('json')->success('修改成功');
}
/**
* @param $id
* @return mixed
* @throws DataNotFoundException
* @throws DbException
* @throws FormBuilderException
* @throws ModelNotFoundException
* @author xaboy
* @day 2020/5/26
*/
public function cloneForm($id)
{
if (!$this->repository->merExists($this->request->merId(), $id))
return app('json')->fail('数据不存在');
return app('json')->success(formToData($this->repository->cloneCouponForm($id)));
}
/**
* @param StoreCouponUserRepository $repository
* @author xaboy
* @day 2020/6/2
*/
public function issue(StoreCouponUserRepository $repository)
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['username', 'coupon', 'status', 'coupon_id', 'type', 'send_id']);
$where['mer_id'] = $this->request->merId();
return app('json')->success($repository->getList($where, $page, $limit));
}
/**
* @return mixed
* @author Qinii
*/
public function select()
{
$where = $this->request->params(['coupon_name']);
$where['status'] = 1;
$where['send_type'] = 3;
[$page, $limit] = $this->getPage();
return app('json')->success($this->repository->getList($this->request->merId(), $where, $page, $limit));
}
public function send(StoreCouponSendValidate $validate, StoreCouponSendRepository $repository)
{
$data = $this->request->params(['coupon_id', 'mark', 'is_all', 'search', 'uid']);
$validate->check($data);
if (!$data['is_all'] && !count($data['uid'])) {
return app('json')->fail('请选择发送用户');
}
$repository->create($data, $this->request->merId());
return app('json')->success('创建成功,正在发送中');
}
/**
* @param $id
* @return mixed
* @throws DbException
* @author xaboy
* @day 2020/7/7
*/
public function delete($id)
{
if (!$this->repository->merExists($this->request->merId(), $id))
return app('json')->fail('数据不存在');
$this->repository->delete($id);
return app('json')->success('删除成功');
}
public function updateForm($id)
{
return app('json')->success(formToData($this->repository->updateForm($this->request->merId(), $id)));
}
public function update($id)
{
if (!$this->repository->merExists($this->request->merId(), $id))
return app('json')->fail('数据不存在');
$data = $this->request->params(['title']);
$this->repository->update($id, $data);
return app('json')->success('修改成功');
}
}

View File

@ -0,0 +1,37 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\coupon;
use app\common\repositories\store\coupon\StoreCouponSendRepository;
use crmeb\basic\BaseController;
use think\App;
class CouponSend extends BaseController
{
protected $repository;
public function __construct(App $app, StoreCouponSendRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
public function lst()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['date', 'coupon_type', 'coupon_name', 'status']);
$where['mer_id'] = $this->request->merId();
return app('json')->success($this->repository->getList($where, $page, $limit));
}
}

View File

@ -0,0 +1,74 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\delivery;
use app\common\repositories\delivery\DeliveryOrderRepository;
use think\App;
use crmeb\basic\BaseController;
use think\exception\ValidateException;
class DeliveryOrder extends BaseController
{
protected $repository;
public function __construct(App $app, DeliveryOrderRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
if (systemConfig('delivery_status') != 1) throw new ValidateException('未开启同城配送');
}
public function lst()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['keyword','station_id','status','date','order_sn','station_type']);
$where['mer_id'] = $this->request->merId();
$data = $this->repository->merList($where, $page, $limit);
return app('json')->success($data);
}
public function detail($id)
{
$data = $this->repository->detail($id,$this->request->merId());
return app('json')->success($data);
}
public function cancelForm($id)
{
return app('json')->success(formToData($this->repository->cancelForm($id)));
}
public function cancel($id)
{
$reason = $this->request->params(['reason','cancel_reason']);
if (empty($reason['reason']))
return app('json')->fail('取消理由不能为空');
$this->repository->cancel($id, $this->request->merId(), $reason);
return app('json')->success('取消成功');
}
public function delete($id)
{
$this->repository->destory($id, $this->request->merId());
return app('json')->success('删除成功');
}
public function switchWithStatus($id)
{
$status = $this->request->param('status') == 1 ? 1 : 0;
$this->repository->update($id,['status' => $status]);
return app('json')->success('修改成功');
}
}

View File

@ -0,0 +1,193 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\delivery;
use app\common\repositories\system\serve\ServeOrderRepository;
use crmeb\services\DeliverySevices;
use think\App;
use crmeb\basic\BaseController;
use app\common\repositories\delivery\DeliveryStationRepository;
use app\validate\supply\DeliveryStationValidate;
use think\exception\ValidateException;
class DeliveryStation extends BaseController
{
protected $repository;
public function __construct(App $app, DeliveryStationRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
public function lst()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['keyword','station_name','status','type','date']);
$where['mer_id'] = $this->request->merId();
$data = $this->repository->merList($where, $page, $limit);
return app('json')->success($data);
}
public function getTypeList()
{
if (systemConfig('delivery_status') != 1) throw new ValidateException('未开启同城配送');
[$page, $limit] = $this->getPage();
$where = $this->request->params(['keyword','station_name']);
$where['mer_id'] = $this->request->merId();
$where['type'] = systemConfig('delivery_type');
$where['status'] = 1;
$data = $this->repository->merList($where, $page, $limit);
return app('json')->success($data);
}
public function detail($id)
{
$data = $this->repository->detail($id,$this->request->merId());
return app('json')->success($data);
}
public function create()
{
if (systemConfig('delivery_status') != 1) throw new ValidateException('未开启同城配送');
$data = $this->checkParams();
$data['mer_id'] = $this->request->merId();
$this->repository->save($data);
return app('json')->success('添加成功');
}
public function update($id)
{
if (systemConfig('delivery_status') != 1) throw new ValidateException('未开启同城配送');
$data = $this->checkParams();
$this->repository->edit($id, $this->request->merId(), $data);
return app('json')->success('编辑成功');
}
public function delete($id)
{
if (systemConfig('delivery_status') != 1) throw new ValidateException('未开启同城配送');
$this->repository->destory($id, $this->request->merId());
return app('json')->success('删除成功');
}
public function switchWithStatus($id)
{
if (systemConfig('delivery_status') != 1) throw new ValidateException('未开启同城配送');
$status = $this->request->param('status') == 1 ? 1 : 0;
$this->repository->update($id,['status' => $status]);
return app('json')->success('修改成功');
}
public function markForm($id)
{
if (systemConfig('delivery_status') != 1) throw new ValidateException('未开启同城配送');
return app('json')->success(formToData($this->repository->markForm($id, $this->request->merId())));
}
public function mark($id)
{
if (systemConfig('delivery_status') != 1) throw new ValidateException('未开启同城配送');
$data = $this->request->params(['mark']);
$this->repository->update($id, $data);
return app('json')->success('备注成功');
}
public function checkParams()
{
$data = $this->request->params([
'station_name',
'business',
'station_address',
'lng',
'lat',
'contact_name',
'phone',
'username',
'password',
['status',1],
'city_name',
]);
$make = app()->make(DeliveryStationValidate::class);
$data['type'] = systemConfig('delivery_type');
if ($data['type'] == DeliverySevices::DELIVERY_TYPE_DADA) {
$make->scene('dada')->check($data);
} else {
$make->check($data);
[$data['lng'],$data['lat']] = gcj02ToBd09($data['lng'],$data['lat']);
}
return $data;
}
public function getBusiness()
{
if (systemConfig('delivery_status') != 1) throw new ValidateException('未开启同城配送');
$data = $this->repository->getBusiness();
return app('json')->success($data);
}
public function options()
{
$where = [
'status' => 1,
'mer_id' => $this->request->merId(),
'type' => systemConfig('delivery_type'),
];
return app('json')->success($this->repository->getOptions($where));
}
public function select()
{
$where = [
'mer_id' => $this->request->merId(),
];
return app('json')->success($this->repository->getOptions($where));
}
public function getCityLst()
{
if (systemConfig('delivery_status') != 1) throw new ValidateException('未开启同城配送');
return app('json')->success($this->repository->getCityLst());
}
/**
* TODO 充值记录
* @author Qinii
* @day 2/18/22
*/
public function payLst()
{
[$page, $limit] = $this->getPage();
$where = [
'type' => 20,
'mer_id' => $this->request->merId(),
'date' => $this->request->param('date'),
];
$data = app()->make(ServeOrderRepository::class)->getList($where, $page, $limit);
$data['delivery_balance'] = $this->request->merchant()->delivery_balance;
return app('json')->success($data);
}
public function getQrcode()
{
if (systemConfig('delivery_status') != 1) throw new ValidateException('未开启同城配送');
$data['pay_type'] = $this->request->param('pay_type',1);
$data['price'] = $this->request->param('price',10);
if (!is_numeric($data['price']) || $data['price'] <= 0 )
return app('json')->fail('支付金额不正确');
$res = app()->make(ServeOrderRepository::class)->QrCode($this->request->merId(), 'delivery', $data);
$res['delivery_balance'] = $this->request->merchant()->delivery_balance;
return app('json')->success($res);
}
}

View File

@ -0,0 +1,134 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\guarantee;
use app\common\repositories\store\GuaranteeRepository;
use app\common\repositories\store\GuaranteeTemplateRepository;
use app\validate\admin\GuaranteeTemplateValidate;
use think\App;
use crmeb\basic\BaseController;
class GuaranteeTemplate extends BaseController
{
/**
* @var GuaranteeTemplateRepository
*/
protected $repository;
/**
* Product constructor.
* @param App $app
* @param GuaranteeTemplateRepository $repository
*/
public function __construct(App $app, GuaranteeTemplateRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
public function lst()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['date','keyword']);
$where['is_del'] = 0;
$where['mer_id'] = $this->request->merId();
$data = $this->repository->getList($where,$page, $limit);
return app('json')->success($data);
}
public function create(GuaranteeTemplateValidate $validate)
{
$data = $this->request->params(['template_name','template_value',['status',1],'sort']);
$validate->check($data);
$data['mer_id'] = $this->request->merId();
$this->repository->create($data);
return app('json')->success('添加成功');
}
public function detail($id)
{
$ret = $this->repository->detail($id,$this->request->merId());
return app('json')->success($ret);
}
public function update($id,GuaranteeTemplateValidate $validate)
{
$data = $this->request->params(['template_name','template_value',['status',1],'sort']);
$validate->check($data);
$this->repository->detail($id,$this->request->merId());
$data['mer_id'] = $this->request->merId();
$this->repository->edit($id,$data);
return app('json')->success('编辑成功');
}
public function delete($id)
{
$this->repository->detail($id,$this->request->merId());
$this->repository->delete($id);
return app('json')->success('删除成功');
}
/**
* TODO 添加模板筛选的条款数据
* @return \think\response\Json
* @author Qinii
* @day 5/25/21
*/
public function select()
{
$where['keyword'] = $this->request->param('keyword');
$where['is_del'] = 0;
$where['status'] = 1;
$data = app()->make(GuaranteeRepository::class)->select($where);
return app('json')->success($data);
}
public function sort($id)
{
$ret = $this->repository->detail($id,$this->request->merId());
if(!$ret) return app('json')->fail('数据不存在');
$data = [
'sort' => $this->request->param('sort'),
];
$this->repository->update($id,$data);
return app('json')->success('修改成功');
}
/**
* TODO 商品选择模板的下拉数据
* @return \think\response\Json
* @author Qinii
* @day 5/25/21
*/
public function list()
{
$data = $this->repository->list($this->request->merId());
return app('json')->success($data);
}
public function switchStatus($id)
{
$ret = $this->repository->detail($id,$this->request->merId());
if(!$ret) return app('json')->fail('数据不存在');
$data = [
'status' => $this->request->param('status') == 1 ?: 0,
];
$this->repository->update($id,$data);
return app('json')->success('修改成功');
}
}

View File

@ -0,0 +1,446 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\order;
use app\common\repositories\store\order\SupplyReconciliationRepository;
use app\common\repositories\store\order\StoreOrderRepository;
use crmeb\jobs\BatchDeliveryJob;
use crmeb\services\ExcelService;
use think\App;
use crmeb\basic\BaseController;
use app\common\repositories\store\order\StoreOrderRepository as repository;
use think\facade\Queue;
class Order extends BaseController
{
protected $repository;
/**
* Product constructor.
* @param App $app
* @param repository $repository
*/
public function __construct(App $app, repository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
public function title()
{
$where = $this->request->params(['status', 'date', 'order_sn', 'username', 'order_type', 'keywords', 'order_id', 'activity_type','filter_delivery','filter_product']);
$where['mer_id'] = $this->request->merId();
return app('json')->success($this->repository->getStat($where, $where['status']));
}
/**
* 订单列表
* @return mixed
* @author Qinii
*/
public function lst()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['status', 'date', 'order_sn', 'username', 'order_type', 'keywords', 'order_id', 'activity_type', 'group_order_sn', 'store_name','filter_delivery','filter_product']);
$where['mer_id'] = $this->request->merId();
$pay_type = $this->request->param('pay_type','');
if ($pay_type != '') $where['pay_type'] = $this->repository::PAY_TYPE_FILTEER[$pay_type];
return app('json')->success($this->repository->merchantGetList($where, $page, $limit));
}
public function takeTitle()
{
$where = $this->request->params(['date', 'order_sn', 'username', 'keywords']);
$where['take_order'] = 1;
$where['status'] = -1;
$where['verify_date'] = $where['date'];
unset($where['date']);
$where['mer_id'] = $this->request->merId();
return app('json')->success($this->repository->getStat($where, ''));
}
/**
* TODO 自提订单列表
* @return mixed
* @author Qinii
* @day 2020-08-17
*/
public function takeLst()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['date', 'order_sn', 'username', 'keywords']);
$where['take_order'] = 1;
$where['status'] = -1;
$where['verify_date'] = $where['date'];
unset($where['date']);
$where['mer_id'] = $this->request->merId();
return app('json')->success($this->repository->merchantGetList($where, $page, $limit));
}
/**
* 订单头部统计
* @return mixed
* @author Qinii
*/
public function chart()
{
return app('json')->success($this->repository->OrderTitleNumber($this->request->merId(), null));
}
/**
* TODO 自提订单头部统计
* @return mixed
* @author Qinii
* @day 2020-08-17
*/
public function takeChart()
{
return app('json')->success($this->repository->OrderTitleNumber($this->request->merId(), 1));
}
/**
* TODO 订单类型
* @return mixed
* @author Qinii
* @day 2020-08-15
*/
public function orderType()
{
$where['mer_id'] = $this->request->merId();
return app('json')->success($this->repository->orderType($where));
}
/**
* @param $id
* @return mixed
* @author Qinii
*/
public function deliveryForm($id)
{
$data = $this->repository->getWhere(['order_id' => $id, 'mer_id' => $this->request->merId(), 'is_del' => 0]);
if (!$data) return app('json')->fail('数据不存在');
if (!$data['paid']) return app('json')->fail('订单未支付');
if (!in_array($data['status'], [0, 1])) return app('json')->fail('订单状态错误');
return app('json')->success(formToData($this->repository->sendProductForm($id, $data)));
}
/**
* TODO 发货
* @param $id
* @return mixed
* @author Qinii
*/
public function delivery($id)
{
$type = $this->request->param('delivery_type');
$split = $this->request->params(['is_split',['split',[]]]);
if (!$this->repository->merDeliveryExists($id, $this->request->merId()))
return app('json')->fail('订单信息或状态错误');
switch ($type)
{
case 3: //虚拟发货
$data = $this->request->params([
'delivery_type',
'remark',
]);
$data['delivery_name'] = '';
$data['delivery_id'] = '';
$method = 'delivery';
break;
case 4: //电子面单
if (!systemConfig('crmeb_serve_dump'))
return app('json')->fail('电子面单功能未开启');
$data = $this->request->params([
'delivery_type',
'delivery_name',
'from_name',
'from_tel',
'from_addr',
'temp_id',
'remark',
]);
if (!$data['from_name'] ||
!$data['delivery_name'] ||
!$data['from_tel'] ||
!$data['from_addr'] ||
!$data['temp_id']
)
return app('json')->fail('填写配送信息');
$method = 'dump';
break;
case 5: //同城配送
if (systemConfig('delivery_status') != 1)
return app('json')->fail('未开启同城配送');
$data = $this->request->params(['delivery_type', 'station_id', 'mark', ['cargo_weight',0], 'remark',]);
if ($data['cargo_weight'] < 0) return app('json')->fail('包裹重量能为负数');
if (!$data['station_id']) return app('json')->fail('请选择门店');
$method = 'cityDelivery';
break;
default: //快递
$data = $this->request->params(['delivery_type', 'delivery_name', 'delivery_id', 'remark',]);
if (!$data['delivery_type'] || !$data['delivery_name'] || !$data['delivery_id'])
return app('json')->fail('填写配送信息');
$method = 'delivery';
break;
}
$res = $this->repository->runDelivery($id,$this->request->merId(), $data, $split, $method);
return app('json')->success('发货成功',$res);
}
/**
* TODO
* @return \think\response\Json
* @author Qinii
* @day 7/26/21
*/
public function batchDelivery()
{
$params = $this->request->params([
'order_id',
'delivery_id',
'delivery_type',
'delivery_name',
'remark',
['select_type', 'select'],
['where', []]
]);
if (!in_array($params['select_type'], ['all', 'select'])) return app('json')->fail('选择了类型错误');
if (!in_array($params['delivery_type'], [2, 3])) return app('json')->fail('发货类型错误');
if ($params['select_type'] == 'select' && !$params['order_id']) return app('json')->fail('需要订单ID');
if ($params['select_type'] == 'all' && empty($params['where'])) return app('json')->fail('需要搜索条件');
// $this->repository->batchDelivery($this->request->merId(),$params);
Queue::push(BatchDeliveryJob::class, [
'mer_id' => $this->request->merId(),
'data' => $params
]);
return app('json')->success('已开始批量发货,请稍后查看');
}
/**
* TODO 改价form
* @param $id
* @return mixed
* @author Qinii
* @day 2020-06-11
*/
public function updateForm($id)
{
if (!$this->repository->merStatusExists($id, $this->request->merId()))
return app('json')->fail('订单信息或状态错误');
return app('json')->success(formToData($this->repository->form($id)));
}
/**
* TODO 改价
* @param $id
* @return mixed
* @author Qinii
* @day 2020-06-11
*/
public function update($id)
{
$data = $this->request->params(['total_price', 'pay_postage']);
if ($data['total_price'] < 0 || $data['pay_postage'] < 0)
return app('json')->fail('金额不可未负数');
if (!$this->repository->merStatusExists($id, $this->request->merId()))
return app('json')->fail('订单信息或状态错误');
$this->repository->eidt($id, $data);
return app('json')->success('修改成功');
}
/**
* @param $id
* @return mixed
* @author Qinii
* @day 2020-06-11
*/
public function detail($id)
{
$data = $this->repository->getOne($id, $this->request->merId());
if (!$data) return app('json')->fail('数据不存在');
return app('json')->success($data);
}
/**
* @param $id
* @return mixed
* @author Qinii
* @day 2020-06-11
*/
public function status($id)
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['date','user_type']);
$where['id'] = $id;
if (!$this->repository->getOne($id, $this->request->merId()))
return app('json')->fail('数据不存在');
return app('json')->success($this->repository->getOrderStatus($where, $page, $limit));
}
/**
* @param $id
* @return mixed
* @author Qinii
* @day 2020-06-11
*/
public function remarkForm($id)
{
return app('json')->success(formToData($this->repository->remarkForm($id)));
}
/**
* @param $id
* @return mixed
* @author Qinii
* @day 2020-06-11
*/
public function remark($id)
{
if (!$this->repository->getOne($id, $this->request->merId()))
return app('json')->fail('数据不存在');
$data = $this->request->params(['remark']);
$this->repository->update($id, $data);
return app('json')->success('备注成功');
}
/**
* 核销
* @param $code
* @author xaboy
* @day 2020/8/15
*/
public function verify($id)
{
$data = $this->request->params(['data','verify_code']);
$this->repository->verifyOrder($id, $this->request->merId(), $data);
return app('json')->success('订单核销成功');
}
public function verifyDetail($code)
{
$order = $this->repository->codeByDetail($code);
if (!$order) return app('json')->fail('订单不存在');
return app('json')->success($order);
}
/**
* @param $id
* @return mixed
* @author Qinii
* @day 2020-06-11
*/
public function delete($id)
{
if (!$this->repository->userDelExists($id, $this->request->merId()))
return app('json')->fail('订单信息或状态错误');
$this->repository->merDelete($id);
return app('json')->success('删除成功');
}
/**
* TODO 快递查询
* @param $id
* @return mixed
* @author Qinii
* @day 2020-06-25
*/
public function express($id)
{
return app('json')->success($this->repository->express($id, $this->request->merId()));
}
/**
* TODO
* @param $id
* @return mixed
* @author Qinii
* @day 2020-07-30
*/
public function reList($id)
{
[$page, $limit] = $this->getPage();
$make = app()->make(SupplyReconciliationRepository::class);
if (!$make->getWhereCount(['mer_id' => $this->request->merId(), 'reconciliation_id' => $id]))
return app('json')->fail('数据不存在');
$where = ['reconciliation_id' => $id, 'type' => 0];
return app('json')->success($this->repository->reconList($where, $page, $limit));
}
/**
* TODO 导出文件
* @author Qinii
* @day 2020-07-30
*/
public function excel()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['status', 'date', 'order_sn', 'order_type', 'username', 'keywords', 'take_order', 'order_id', 'activity_type', 'group_order_sn', 'store_name', 'filter_delivery', 'filter_product', 'pay_type']);
if ($where['pay_type'] != '') $where['pay_type'] = $this->repository::PAY_TYPE_FILTEER[$where['pay_type']];
if ($where['take_order']) {
$where['status'] = -1;
$where['verify_date'] = $where['date'];
unset($where['date']);
unset($where['order_type']);
}
$where['mer_id'] = $this->request->merId();
$data = app()->make(ExcelService::class)->order($where,$page,$limit);
return app('json')->success($data);
}
/**
* TODO 打印小票
* @param $id
* @return mixed
* @author Qinii
* @day 2020-07-30
*/
public function printer($id)
{
$merId = $this->request->merId();
if (!$this->repository->getWhere(['order_id' => $id, 'mer_id' => $merId]))
return app('json')->fail('数据不存在');
$this->repository->batchPrinter($id, $merId);
return app('json')->success('打印成功');
}
/**
* TODO 导出发货单
* @return \think\response\Json
* @author Qinii
* @day 3/13/21
*/
public function deliveryExport()
{
$where = $this->request->params(['username', 'date', 'activity_type', 'order_type', 'username', 'keywords', 'id']);
$where['order_ids'] = $this->request->param('ids');
$where['mer_id'] = $this->request->merId();
$where['status'] = 0;
$where['paid'] = 1;
$make = app()->make(StoreOrderRepository::class);
if (is_array($where['id'])) $where['order_ids'] = $where['id'];
$count = $make->search($where)->count();
if (!$count) return app('json')->fail('没有可导出数据');
[$page, $limit] = $this->getPage();
$data = app()->make(ExcelService::class)->delivery($where,$page,$limit);
return app('json')->success($data);
}
public function childrenList($id)
{
$data = $this->repository->childrenList($id, $this->request->merId());
return app('json')->success($data);
}
}

View File

@ -0,0 +1,138 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\order;
use think\App;
use crmeb\basic\BaseController;
use app\common\repositories\store\order\StoreOrderReceiptRepository;
class OrderReceipt extends BaseController
{
protected $repository;
public function __construct(App $app, StoreOrderReceiptRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
/**
* TODO 列表
* @return mixed
* @author Qinii
* @day 2020-10-17
*/
public function Lst()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['status', 'date', 'receipt_sn','username','order_type','keyword']);
$where['mer_id'] = $this->request->merId();
return app('json')->success($this->repository->getList($where, $page, $limit));
}
/**
* TODO 平台列表
* @return mixed
* @author Qinii
* @day 2020-10-17
*/
public function getList()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['status', 'date', 'receipt_sn','username','order_type','keyword','mer_id']);
return app('json')->success($this->repository->getList($where, $page, $limit));
}
public function setRecipt()
{
$ids = $this->request->param('ids');
if(!$ids) return app('json')->fail('请选择需要合并的发票');
$this->repository->merExists($ids,$this->request->merId());
return app('json')->success($this->repository->setRecipt($ids,$this->request->merId()));
}
/**
* TODO 开票
* @return mixed
* @author Qinii
* @day 2020-10-17
*/
public function saveRecipt()
{
$data = $this->request->param(['ids','receipt_sn','receipt_price','receipt_no','mer_mark']);
$this->repository->merExists($data['ids'],$this->request->merId());
if(!is_numeric($data['receipt_price']) || $data['receipt_price'] < 0)
return app('json')->fail('发票信息金额格式错误');
//if(!$data['receipt_no'])return app('json')->fail('请填写发票号');
$this->repository->save($data);
return app('json')->success('开票成功');
}
/**
* TODO 备注form
* @param $id
* @return mixed
* @author Qinii
* @day 2020-10-17
*/
public function markForm($id)
{
return app('json')->success(formToData($this->repository->markForm($id)));
}
/**
* TODO 备注
* @param $id
* @return mixed
* @author Qinii
* @day 2020-10-17
*/
public function mark($id)
{
if(!$this->repository->getWhereCount(['order_receipt_id' => $id,'mer_id' => $this->request->merId()]))
return app('json')->fail('数据不存在');
$data = $this->request->params(['mer_mark']);
$this->repository->update($id,$data);
return app('json')->success('备注成功');
}
public function detail($id)
{
$mer_id = $this->request->merId();
$where = [$this->repository->getPk() => $id];
if($mer_id) $where['mer_id'] = $mer_id;
$data = $this->repository->getSearch($where)->find();
if(!$data) return app('json')->fail('数据不存在');
if($data['receipt_info']->receipt_type == 1 ){
$title = $data['receipt_info']->receipt_title_type == 1 ? '个人电子普通发票' : '企业电子普通发票';
}else{
$title = '企业专用纸质发票';
}
$data['title'] = $title;
return app('json')->success($data);
}
public function update($id)
{
$data = $this->request->params(['receipt_no','mer_mark']);
if(!empty($data['receipt_no'])) $data['status'] = 1;
$where = [$this->repository->getPk() => $id,'mer_id' => $this->request->merId()];
$res = $this->repository->getSearch($where)->find();
if(!$res) return app('json')->fail('数据不存在');
$this->repository->updateBySn($res['receipt_sn'],$data);
return app('json')->success('编辑成功');
}
}

View File

@ -0,0 +1,73 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\order;
use think\App;
use crmeb\basic\BaseController;
use app\common\repositories\store\order\SupplyReconciliationRepository as repository;
class Reconciliation extends BaseController
{
protected $repository;
public function __construct(App $app,repository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
public function lst()
{
[$page,$limit] = $this->getPage();
$where = $this->request->params(['date','status','is_accounts','reconciliation_id','keyword']);
$where['mer_id'] = $this->request->merId();
return app('json')->success($this->repository->getList($where,$page,$limit));
}
/**
* TODO 确认订单
* @param $id
* @return mixed
* @author Qinii
* @day 2020-06-15
*/
public function switchStatus($id)
{
if(!$this->repository->merWhereCountById($id,$this->request->merId()))
return app('json')->fail('数据不存在或状态错误');
$status = ($this->request->param('status') == 1) ? 1 : 2;
$data['status'] = $status;
$data['mer_admin_id'] = $this->request->merId();
$this->repository->switchStatus($id,$data);
return app('json')->success('修改成功');
}
public function markForm($id)
{
if(!$this->repository->getWhereCount([$this->repository->getPk() => $id,'mer_id' => $this->request->merId()]))
return app('json')->fail('数据不存在');
return app('json')->success(formToData($this->repository->markForm($id)));
}
public function mark($id)
{
if(!$this->repository->getWhereCount([$this->repository->getPk() => $id,'mer_id' => $this->request->merId()]))
return app('json')->fail('数据不存在');
$data = $this->request->params(['mark']);
$this->repository->update($id,$data);
return app('json')->success('备注成功');
}
}

View File

@ -0,0 +1,273 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\order;
use app\common\repositories\store\order\SupplyReconciliationRepository;
use app\common\repositories\store\order\StoreOrderProductRepository;
use app\common\repositories\store\order\StoreOrderRepository;
use app\common\repositories\store\order\StoreOrderStatusRepository;
use crmeb\services\ExcelService;
use think\App;
use crmeb\basic\BaseController;
use app\common\repositories\store\order\StoreRefundOrderRepository as repository;
class RefundOrder extends BaseController
{
/**
* @var repository
*/
protected $repository;
/**
* Order constructor.
* @param App $app
* @param repository $repository
*/
public function __construct(App $app, repository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
/**
* TODO 获取可退款的商品信息
* @param $id
* @param StoreOrderRepository $storeOrderRepository
* @param StoreOrderProductRepository $orderProductRepository
* @return \think\response\Json
* @author Qinii
* @day 2023/7/13
*/
public function check($id, StoreOrderRepository $storeOrderRepository, StoreOrderProductRepository $orderProductRepository)
{
$order = $storeOrderRepository->getSearch(['mer_id' => $this->request->merId()])->where('order_id',$id)->find();
if (!$order) return app('json')->fail('订单状态有误');
if (!$order->refund_status) return app('json')->fail('订单已过退款/退货期限');
if ($order->status < 0) return app('json')->fail('订单已退款');
if ($order->status == 10) return app('json')->fail('订单不支持退款');
$product = $orderProductRepository->userRefundProducts([],0,$id,0);
$total_refund_price = $this->repository->getRefundsTotalPrice($order,$product,0);
$activity_type = $order->activity_type;
$status = (!$order->status || $order->status == 9) ? 0 : $order->status;
$postage_price = 0;
return app('json')->success(compact('activity_type', 'total_refund_price','postage_price', 'product', 'status'));
}
public function compute(StoreOrderRepository $storeOrderRepository)
{
$refund = $this->request->param('refund',[]);
$orderId = $this->request->param('order_id',0);
$order = $storeOrderRepository->getSearch(['mer_id' => $this->request->merId()])->where('order_id',$orderId)->find();
if (!$order) return app('json')->fail('订单状态有误');
if (!$order->refund_status) return app('json')->fail('订单已过退款/退货期限');
if ($order->status < 0) return app('json')->fail('订单已退款');
if ($order->status == 10) return app('json')->fail('订单不支持退款');
$totalRefundPrice = $this->repository->compute($order,$refund);
return app('json')->success(compact('totalRefundPrice'));
}
/**
* TODO 创建退款单,并执行退款操作
* @param StoreOrderRepository $storeOrderRepository
* @return \think\response\Json
* @author Qinii
* @day 2023/7/13
*/
public function create(StoreOrderRepository $storeOrderRepository)
{
$data = $this->request->params(['refund_message','refund_price','mer_mark']);
$refund = $this->request->param('refund',[]);
$orderId = $this->request->param('order_id',02);
$order = $storeOrderRepository->getSearch(['mer_id' => $this->request->merId()])->where('order_id',$orderId)->find();
if (!$order) return app('json')->fail('订单状态有误');
if (!$order->refund_status) return app('json')->fail('订单已过退款/退货期限');
if ($order->status < 0) return app('json')->fail('订单已退款');
if ($order->status == 10) return app('json')->fail('订单不支持退款');
$data['refund_type'] = 1;
$data['admin_id'] = $this->request->adminId();
$data['user_type'] = $this->request->userType();
$refund = $this->repository->merRefund($order,$refund,$data);
return app('json')->success('退款成功',['refund_order_id' => $refund->refund_order_id]);
}
/**
* @return mixed
* @author Qinii
* @day 2020-06-12
*/
public function lst()
{
list($page,$limit) = $this->getPage();
$where = $this->request->params(['refund_order_sn','status','refund_type','date','order_sn','id','delivery_id','user_type','username']);
$where['mer_id'] = $this->request->merId();
return app('json')->success($this->repository->getList($where,$page,$limit));
}
/**
* @param $id
* @return mixed
* @author Qinii
* @day 2020-06-12
*/
public function detail($id)
{
if(!$this->repository->getExistsById($this->request->merId(),$id))
return app('json')->fail('数据不存在');
return app('json')->success($this->repository->getOne($id));
}
/**
* @param $id
* @return mixed
* @author Qinii
* @day 2020-06-12
*/
public function switchStatus($id)
{
if(!$this->repository->getStatusExists($this->request->merId(),$id))
return app('json')->fail('信息或状态错误');
$status = ($this->request->param('status') == 1) ? 1 : -1;
event('refund.status',compact('id','status'));
if($status == 1){
$data = $this->request->params(['mer_delivery_user','mer_delivery_address','phone']);
if ($data['phone'] && isPhone($data['phone']))
return app('json')->fail('请输入正确的手机号');
$data['status'] = $status;
$this->repository->agree($id,$data);
}else{
$fail_message = $this->request->param('fail_message','');
if($status == -1 && empty($fail_message))
return app('json')->fail('未通过必须填写');
$data['status'] = $status;
$data['fail_message'] = $fail_message;
$this->repository->refuse($id,$data);
}
return app('json')->success('审核成功');
}
/**
* TODO 收货后确定退款
* @param $id
* @return mixed
* @author Qinii
* @day 2020-06-12
*/
public function refundPrice($id)
{
if(!$this->repository->getRefundPriceExists($this->request->merId(),$id))
return app('json')->fail('信息或状态错误');
$this->repository->adminRefund($id,0);
return app('json')->success('退款成功');
}
/**
* TODO
* @param $id
* @return mixed
* @author Qinii
* @day 2020-06-12
*/
public function switchStatusForm($id)
{
if(!$this->repository->getStatusExists($this->request->merId(),$id))
return app('json')->fail('信息或状态错误');
return app('json')->success(formToData($this->repository->statusForm($id)));
}
/**
* TODO
* @param $id
* @return mixed
* @author Qinii
* @day 2020-06-18
*/
public function delete($id)
{
if(!$this->repository->getUserDelExists($this->request->merId(),$id))
return app('json')->fail('信息或状态错误');
$this->repository->update($id,['is_system_del' => 1]);
return app('json')->success('删除成功');
}
/**
* TODO
* @param $id
* @return mixed
* @author Qinii
* @day 2020-06-18
*/
public function markForm($id)
{
if(!$this->repository->getExistsById($this->request->merId(),$id))
return app('json')->fail('数据不存在');
return app('json')->success(formToData($this->repository->markForm($id)));
}
/**
* TODO
* @param $id
* @return mixed
* @author Qinii
* @day 2020-06-18
*/
public function mark($id)
{
if(!$this->repository->getExistsById($this->request->merId(),$id))
return app('json')->fail('数据不存在');
$this->repository->update($id,['mer_mark' => $this->request->param('mer_mark','')]);
return app('json')->success('备注成功');
}
public function log($id)
{
list($page,$limit) = $this->getPage();
$where = $this->request->params(['date','user_type']);
$where['id'] = $id;
$where['type'] = StoreOrderStatusRepository::TYPE_REFUND;
$data = app()->make(StoreOrderStatusRepository::class)->search($where,$page,$limit);
return app('json')->success($data);
}
public function reList($id)
{
[$page,$limit] = $this->getPage();
$make = app()->make(SupplyReconciliationRepository::class);
if(!$make->getWhereCount(['mer_id' => $this->request->merId(),'reconciliation_id' => $id]))
return app('json')->fail('数据不存在');
$where = ['reconciliation_id' => $id,'type' => 1];
return app('json')->success($this->repository->reconList($where,$page,$limit));
}
/**
* TODO 快递查询
* @param $id
* @return mixed
* @author Qinii
* @day 2020-06-25
*/
public function express($id)
{
return app('json')->success($this->repository->express($id));
}
public function createExcel()
{
$where = $this->request->params(['refund_order_sn','status','refund_type','date','order_sn','id']);
$where['mer_id'] = $this->request->merId();
[$page, $limit] = $this->getPage();
$data = app()->make(ExcelService::class)->refundOrder($where, $page, $limit);
return app('json')->success($data);
}
}

View File

@ -0,0 +1,133 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\product;
use app\common\repositories\store\product\StoreDiscountRepository;
use app\validate\supply\StoreDiscountsValidate;
use crmeb\basic\BaseController;
use think\App;
use think\exception\ValidateException;
class Discounts extends BaseController
{
protected $repository ;
/**
* Product constructor.
* @param App $app
* @param StoreDiscountRepository $repository
*/
public function __construct(App $app ,StoreDiscountRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
public function lst()
{
[$page, $limit] = $this->getPage();
$status = $this->request->param('status');
$where = $this->request->params(['keyword','store_name','title','type']);
$where['is_show'] = $status;
$where['mer_id'] = $this->request->merId();
$data = $this->repository->getMerlist($where, $page, $limit);
return app('json')->success($data);
}
public function create()
{
$data = $this->checkParams();
$this->repository->save($data);
return app('json')->success('添加成功');
}
public function update($id)
{
$data = $this->checkParams();
if (!$this->repository->getWhere(['mer_id' => $data['mer_id'], $this->repository->getPk() => $id]))
return app('json')->fail('数据不存在');
$data['discount_id'] = $id;
$this->repository->save($data);
return app('json')->success('编辑成功');
}
public function detail($id)
{
$data = $this->repository->detail($id, $this->request->merId());
if (!$data ) return app('json')->fail('数据不存在');
return app('json')->success($data);
}
public function switchStatus($id)
{
$status = $this->request->param('status') == 1 ?: 0;
if (!$this->repository->getWhere([$this->repository->getPk() => $id,'mer_id' => $this->request->merId()]))
return app('json')->fail('数据不存在');
$this->repository->update($id, ['is_show' => $status]);
return app('json')->success('修改成功');
}
public function delete($id)
{
if (!$this->repository->getWhere([$this->repository->getPk() => $id,'mer_id' => $this->request->merId()]))
return app('json')->fail('数据不存在');
$this->repository->update($id, ['is_del' => 1]);
return app('json')->success('删除成功');
}
public function checkParams()
{
$params = [
['title', ''],
['image', ''],
['type', 0],
['is_limit', 0],
['limit_num', 0],
['is_time', 0],
['time', []],
['sort', 0],
['free_shipping', 0],
['status', 0],
['is_show', 1],
['products', []],
['temp_id',0],
];
$data = $this->request->params($params);
app()->make(StoreDiscountsValidate::class)->check($data);
if ($data['is_time'] && is_array($data['time'])) {
if (empty($data['time'])) throw new ValidateException('开始时间必须填写');
[$start, $end] = $data['time'];
$start = strtotime($start);
$end = strtotime($end);
if($start > $end){
throw new ValidateException('开始时间必须小于结束时间');
}
if($start < time() || $end < time()){
throw new ValidateException('套餐时间不能小于当前时间');
}
}
foreach ($data['products'] as $item) {
if (!isset($item['items']))
throw new ValidateException('请选择' . $item['store_name'] . '的规格');
foreach ($item['attr'] as $attr) {
if($attr['active_price'] > $attr['price']) throw new ValidateException('套餐价格高于原价');
}
}
$data['mer_id'] = $this->request->merId();
return $data;
}
}

View File

@ -0,0 +1,495 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\product;
use app\common\repositories\store\order\StoreCartRepository;
use app\common\repositories\store\product\ProductAttrValueRepository;
use app\common\repositories\store\product\ProductBatchProcessRepository;
use app\common\repositories\store\product\SpuRepository;
use app\common\repositories\store\shipping\ShippingTemplateRepository;
use app\common\repositories\store\StoreCategoryRepository;
use app\common\repositories\system\operate\OperateLogRepository;
use crmeb\services\UploadService;
use think\App;
use crmeb\basic\BaseController;
use app\validate\supply\StoreProductValidate as validate;
use app\common\repositories\store\product\ProductRepository as repository;
use think\exception\ValidateException;
use think\facade\Cache;
class Product extends BaseController
{
protected $repository;
/**
* Product constructor.
* @param App $app
* @param repository $repository
*/
public function __construct(App $app, repository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
/**
* @Author:Qinii
* @Date: 2020/5/18
* @return mixed
*/
public function lst()
{
[$page, $limit] = $this->getPage();
$type = $this->request->param('type', 1);
$where = $this->request->params(['temp_id', 'cate_id', 'keyword', 'mer_cate_id', 'is_gift_bag', 'status', 'us_status', 'product_id', 'mer_labels', ['order', 'sort'], 'is_ficti', 'svip_price_type', 'filters_type', 'is_action', 'is_good', 'not_product_id', 'form_id']);
$where = array_merge($where, $this->repository->switchType($type, $this->request->merId(), 0));
return app('json')->success($this->repository->getList($this->request->merId(), $where, $page, $limit));
}
/**
* @Author:Qinii
* @Date: 2020/5/18
* @param $id
* @return mixed
*/
public function detail($id)
{
if (!$this->repository->merExists($this->request->merId(), $id))
return app('json')->fail('数据不存在');
return app('json')->success($this->repository->getAdminOneProduct($id, null));
}
/**
* @Author:Qinii
* @Date: 2020/5/18
* @param validate $validate
* @return mixed
* @attr: 规格参数[];
* @attrValue: SkU数据[];
* @brand_id?: number 品牌的ID;
* @cate_id: number 平台商品分类平台的商品分类ID单选 ;
* @content: string 详情;
* @delivery_free: number 是否包邮0.1.;
* @delivery_way: string[] 商品支持的配送类型1.仅到店自提2快递计价配送;
* @extension_type?: string 佣金比例 0.系统1.自定义,佣金比例 0.系统,即根据商户统一设置的比例计算; 1.自定义手动在每个sku价格后面填写佣金金额;
* @image: string 封面图,列表展示图;
* @keyword: string 商品关键字,在分享海报或者微信分享好友等,会使用到;
* @mer_cate_id?: string[] 商户商品分类商户商品分类ID多选;
* @once_max_count?: number 订单单次购买数量最大限制,例如 5单次购买不得超过5件/ 或者此商品每个商户只能购买5件根据 pay_limit 类型决定;
* @once_min_count?: number 单次购买最低限购,例如 5则是5件起购;
* @pay_limit?: number 是否限购,购买总数限制 0:不限购1单次限购 2 长期限购;
* @refund_switch?: number 商品是否支持退款1.支持 0.不支持;
* @slider_image: string[] 轮播图,详情页展示;
* @spec_type: number 规格类型0单规格 1 多规格;
* @store_info: string 商品简介;
* @store_name: string 商品名称;
* @svip_price_type?: number 会员价类型0不参加1默认比例2自定义;
* @unit_name: string 单位计量单位例如个、kg等;
* @video_link?: string 视频链接地址;
* @attr.value: string 规格名,例如尺码;
* @attr.detail: string[] 规格值,["S (适合36-37)", "M (适合38-39)", "L (适合40-41)"];
* @attrValue.cost: number 成本价;
* @attrValue.detail: { [key: string]: any } 当前SKU信息当前sku组合的信息例如"detail": {"颜色": "粉红色","尺码": "S (适合36-37)"}则表示当前的规格是颜色为粉红色尺码为S的组合;
* @attrValue.extension_one?: number 一级佣金,如果 extension_type 值为1 此项必填但金额不得超过单价price参数;
* @attrValue.extension_two?: number 二级佣金,如果 extension_type 值为1 此项必填但金额不得超过单价price参数;
* @attrValue.image: string sku封面图选中当前规格会在移动端详情中显示的图片;
* @attrValue.ot_price: number 原价;
* @attrValue.price: number 售价;
* @attrValue.stock: number 库存;
* @attrValue.svip_price: string会员价如果 svip_price_type 值为 1 此项必填当svip_price_type值为1此项值为0时付费会员免费获取;
* @attrValue.volume: number 体积;
* @attrValue.weight: number 重量;
*/
public function create()
{
$params = $this->request->params($this->repository::CREATE_PARAMS);
$data = $this->repository->checkParams($params, $this->request->merId());
$data['mer_id'] = $this->request->merId();
$data['admin_id'] = $this->request->merAdminId();
if ($data['is_gift_bag'] && !$this->repository->checkMerchantBagNumber($data['mer_id']))
return app('json')->fail('礼包数量超过数量限制');
$data['status'] = $this->request->merchant()->is_audit ? 0 : 1;
$data['mer_status'] = ($this->request->merchant()->is_del || !$this->request->merchant()->mer_state || !$this->request->merchant()->status) ? 0 : 1;
$data['rate'] = 3;
$data['admin_info'] = $this->request->adminInfo();
$this->repository->create($data, 0);
return app('json')->success('添加成功');
}
/**
* @Author:Qinii
* @Date: 2020/5/18
* @param $id
* @param validate $validate
* @return mixed
*/
public function update($id)
{
$params = $this->request->params($this->repository::CREATE_PARAMS);
$data = $this->repository->checkParams($params, $this->request->merId(), $id);
if (!$this->repository->merExists($this->request->merId(), $id))
return app('json')->fail('数据不存在');
$pro = $this->repository->getWhere(['product_id' => $id]);
if ($pro->status == -2) {
$data['status'] = 0;
} else {
$data['status'] = $this->request->merchant()->is_audit ? 0 : 1;
}
$data['mer_status'] = ($this->request->merchant()->is_del || !$this->request->merchant()->mer_state || !$this->request->merchant()->status) ? 0 : 1;
$data['mer_id'] = $this->request->merId();
$data['admin_info'] = $this->request->adminInfo();
$productData = $this->repository->edit($id, $data, $this->request->merId(), 0);
$product = $productData->toArray();
ksort($product);
$cache_unique = 'get_product_show_' . $id . '_' . md5(json_encode($product));
Cache::delete($cache_unique);
return app('json')->success('编辑成功');
}
/**
* @Author:Qinii
* @Date: 2020/5/18
* @param $id
* @return mixed
*/
public function delete($id)
{
if (!$this->repository->merExists($this->request->merId(), $id))
return app('json')->fail('数据不存在');
if ($this->repository->getWhereCount(['product_id' => $id, 'is_show' => 1, 'status' => 1]))
return app('json')->fail('商品上架中');
$this->repository->delete($id);
//queue(ChangeSpuStatusJob::class,['product_type' => 0,'id' => $id]);
return app('json')->success('转入回收站');
}
public function destory($id)
{
if (!$this->repository->merDeleteExists($this->request->merId(), $id))
return app('json')->fail('只能删除回收站的商品');
// if(app()->make(StoreCartRepository::class)->getProductById($id))
// return app('json')->fail('商品有被加入购物车不可删除');
$this->repository->destory($id);
return app('json')->success('删除成功');
}
/**
* @Author:Qinii
* @Date: 2020/5/18
* @return mixed
*/
public function getStatusFilter()
{
return app('json')->success($this->repository->getFilter($this->request->merId(), '商品', 0));
}
/**
* TODO
* @return mixed
* @author Qinii
* @day 2020-06-24
*/
public function config()
{
$data = systemConfig(['extension_status', 'svip_switch_status', 'integral_status']);
$merData = merchantConfig($this->request->merId(), ['mer_integral_status', 'mer_integral_rate', 'mer_svip_status', 'svip_store_rate']);
$svip_store_rate = $merData['svip_store_rate'] > 0 ? bcdiv($merData['svip_store_rate'], 100, 2) : 0;
$data['mer_svip_status'] = ($data['svip_switch_status'] && $merData['mer_svip_status'] != 0) ? 1 : 0;
$data['svip_store_rate'] = $svip_store_rate;
$data['integral_status'] = $data['integral_status'] && $merData['mer_integral_status'] ? 1 : 0;
$data['integral_rate'] = $merData['mer_integral_rate'] ?: 0;
$data['delivery_way'] = $this->request->merchant()->delivery_way ? $this->request->merchant()->delivery_way : [2];
$data['is_audit'] = $this->request->merchant()->is_audit;
return app('json')->success($data);
}
/**
* TODO
* @param $id
* @return mixed
* @author Qinii
* @day 2020-07-03
*/
public function restore($id)
{
if (!$this->repository->merDeleteExists($this->request->merId(), $id))
return app('json')->fail('只能恢复回收站的商品');
$this->repository->restore($id);
return app('json')->success('商品已恢复');
}
/**
* @return \think\response\Json
* @throws \think\Exception
* @author xaboy
* @day 2020/11/16
*/
public function temp_key()
{
$upload = UploadService::create();
$re = $upload->getTempKeys();
return app('json')->success($re);
}
public function updateSort($id)
{
$sort = $this->request->param('sort');
$this->repository->updateSort($id, $this->request->merId(), ['sort' => $sort]);
return app('json')->success('修改成功');
}
public function preview()
{
$data = $this->request->param();
$data['merchant'] = [
'mer_name' => $this->request->merchant()->mer_name,
'is_trader' => $this->request->merchant()->is_trader,
'mer_avatar' => $this->request->merchant()->mer_avatar,
'product_score' => $this->request->merchant()->product_score,
'service_score' => $this->request->merchant()->service_score,
'postage_score' => $this->request->merchant()->postage_score,
'service_phone' => $this->request->merchant()->service_phone,
'care_count' => $this->request->merchant()->care_count,
'type_name' => $this->request->merchant()->type_name->type_name ?? '',
'care' => true,
'recommend' => $this->request->merchant()->recommend,
];
$data['mer_id'] = $this->request->merId();
$data['status'] = 1;
$data['mer_status'] = 1;
$data['rate'] = 3;
return app('json')->success($this->repository->preview($data));
}
public function setLabels($id)
{
$data = $this->request->params(['mer_labels']);
app()->make(SpuRepository::class)->setLabels($id, 0, $data, $this->request->merId());
return app('json')->success('修改成功');
}
public function getAttrValue($id)
{
$data = $this->repository->getAttrValue($id, $this->request->merId());
return app('json')->success($data);
}
public function freeTrial($id)
{
$params = [
"mer_cate_id",
"sort",
"is_show",
"is_good",
"attr",
"attrValue",
'spec_type'
];
$data = $this->request->params($params);
if (!empty($data['mer_cate_id'])) {
$count = app()->make(StoreCategoryRepository::class)->getWhereCount(['store_category_id' => $data['mer_cate_id'], 'is_show' => 1, 'mer_id' => $this->request->merId()]);
if (!$count) throw new ValidateException('商户分类不存在或不可用');
}
$data['status'] = 1;
$this->repository->freeTrial($id, $data, $this->request->merId(), $this->request->adminInfo());
return app('json')->success('编辑成功');
}
/**
* TODO 上下架
* @Author:Qinii
* @Date: 2020/5/18
* @param int $id
* @return mixed
*/
public function switchStatus($id)
{
$status = $this->request->param('status', 0) == 1 ? 1 : 0;
$this->repository->switchShow($id, $status, 'is_show', $this->request->merId(), $this->request->adminInfo());
return app('json')->success('修改成功');
}
/**
* TODO 批量上下架
* @return \think\response\Json
* @author Qinii
* @day 2022/9/6
*/
public function batchShow()
{
$ids = $this->request->param('ids');
if (empty($ids)) return app('json')->fail('请选择商品');
$status = $this->request->param('status') == 1 ? 1 : 0;
$this->repository->batchSwitchShow($ids, $status, 'is_show', $this->request->merId(), $this->request->adminInfo());
return app('json')->success('修改成功');
}
/**
* TODO 批量设置模板
* @return \think\response\Json
* @author Qinii
* @day 2022/9/6
*/
public function batchTemplate()
{
$ids = $this->request->param('ids');
$ids = is_array($ids) ? $ids : explode(',', $ids);
$data = $this->request->params(['temp_id']);
if (empty($ids)) return app('json')->fail('请选择商品');
if (empty($data['temp_id'])) return app('json')->fail('请选择运费模板');
if (!$this->repository->merInExists($this->request->merId(), $ids)) return app('json')->fail('请选择您自己商品');
$make = app()->make(ShippingTemplateRepository::class);
if (!$make->merInExists($this->request->merId(), [$data['temp_id']]))
return app('json')->fail('请选择您自己的运费模板');
$data['delivery_free'] = 0;
$this->repository->updates($ids, $data);
return app('json')->success('修改成功');
}
/**
* TODO 批量标签
* @return \think\response\Json
* @author Qinii
* @day 2022/9/6
*/
public function batchLabels()
{
$ids = $this->request->param('ids');
$data = $this->request->params(['mer_labels']);
if (empty($ids)) return app('json')->fail('请选择商品');
if (!$this->repository->merInExists($this->request->merId(), $ids))
return app('json')->fail('请选择您自己商品');
app()->make(SpuRepository::class)->batchLabels($ids, $data, $this->request->merId());
return app('json')->success('修改成功');
}
/**
* TODO 批量设置推荐类型
* @return \think\response\Json
* @author Qinii
* @day 2022/9/6
*/
public function batchHot()
{
$ids = $this->request->param('ids');
$data['is_good'] = 1;
if (empty($ids)) return app('json')->fail('请选择商品');
if (!$this->repository->merInExists($this->request->merId(), $ids))
return app('json')->fail('请选择您自己商品');
$this->repository->updates($ids, $data);
return app('json')->success('修改成功');
}
/**
* TODO 批量设置佣金
* @param ProductAttrValueRepository $repository
* @return \think\response\Json
* @author Qinii
* @day 2022/12/26
*/
public function batchExtension(ProductAttrValueRepository $repository)
{
$ids = $this->request->param('ids');
$data = $this->request->params(['extension_one', 'extension_two']);
if ($data['extension_one'] > 1 || $data['extension_one'] < 0 || $data['extension_two'] < 0 || $data['extension_two'] > 1) {
return app('json')->fail('比例01之间');
}
if (empty($ids)) return app('json')->fail('请选择商品');
if (!$this->repository->merInExists($this->request->merId(), $ids))
return app('json')->fail('请选择您自己商品');
$repository->updatesExtension($ids, $data);
return app('json')->success('修改成功');
}
public function batchSvipType()
{
$ids = $this->request->param('ids');
$data = $this->request->params([['svip_price_type', 0]]);
if (empty($ids)) return app('json')->fail('请选择商品');
if (!$this->repository->merInExists($this->request->merId(), $ids))
return app('json')->fail('请选择您自己商品');
$this->repository->updates($ids, $data);
return app('json')->success('修改成功');
}
public function isFormatAttr($id)
{
$data = $this->request->params([
['attrs', []],
['items', []],
['product_type', 0]
]);
$data = $this->repository->isFormatAttr($data['attrs'], $id);
return app('json')->success($data);
}
/**
* 获取批量操作类型
* @return \think\response\Json
*
* @date 2023/10/12
* @author yyw
*/
public function getBatchList()
{
$productBatch = app()->make(ProductBatchProcessRepository::class);
return app('json')->success($productBatch->getTypeList());
}
/**
* 商品批量操作
* @return \think\response\Json
*
* @date 2023/10/12
* @author yyw
*/
public function batchProcess()
{
$ids = $this->request->param('ids', []);
$batch_type = $this->request->param('batch_type');
$batch_select_type = $this->request->param('batch_select_type', 'select');
$admin_info = $this->request->adminInfo();
// 商品列表 搜索条件
$where = $this->request->param('where', []) ?: [];
if (!empty($where)) {
$where = array_merge($where, $this->repository->switchType($where['type'], $this->request->merId(), 0));
}
$productBatch = app()->make(ProductBatchProcessRepository::class);
$type_info = $productBatch->getTypeInfo($batch_type);
$data = $this->request->params($type_info['param']);
$res = $productBatch->setProductIds($this->request->merId(), $batch_type, $batch_select_type, $where, $ids, $data, $admin_info);
if (is_string($res)) {
return app('json')->success($res);
}
return app('json')->success('修改成功');
}
public function getOperateList($product_id)
{
$where = $this->request->params([
['type', ''],
['date', '']
]);
$where['relevance_id'] = $product_id;
$where['relevance_type'] = OperateLogRepository::RELEVANCE_PRODUCT;
[$page, $limit] = $this->getPage();
return app('json')->success(app()->make(OperateLogRepository::class)->lst($where, $page, $limit));
}
}

View File

@ -0,0 +1,170 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\product;
use app\common\repositories\store\product\ProductAssistRepository as repository;
use app\common\repositories\store\product\ProductRepository;
use app\common\repositories\store\product\SpuRepository;
use crmeb\basic\BaseController;
use think\App;
use app\validate\supply\StoreProductAssistValidate;
use think\exception\ValidateException;
class ProductAssist extends BaseController
{
protected $repository ;
/**
* Product constructor.
* @param App $app
* @param repository $repository
*/
public function __construct(App $app ,repository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
/**
* TODO 列表
* @return mixed
* @author Qinii
* @day 2020-10-12
*/
public function lst()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['product_status','keyword','is_show','type','presell_type','us_status','product_assist_id','mer_labels']);
$where['mer_id'] = $this->request->merId();
return app('json')->success($this->repository->getMerchantList($where,$page,$limit));
}
/**
* TODO 添加
* @param StoreProductAssistValidate $validate
* @return mixed
* @author Qinii
* @day 2020-10-12
*/
public function create(StoreProductAssistValidate $validate)
{
$data = $this->checkParams($validate);
$this->repository->create($this->request->merId(),$data);
return app('json')->success('添加成功');
}
/**
* TODO 详情
* @param $id
* @return mixed
* @author Qinii
* @day 2020-10-12
*/
public function detail($id)
{
$data = $this->repository->detail($this->request->merId(),$id);
return app('json')->success($data);
}
/**
* TODO
* @param $id
* @param StoreProductAssistValidate $validate
* @return mixed
* @author Qinii
* @day 2020-10-13
*/
public function update($id,StoreProductAssistValidate $validate)
{
$data = $this->checkParams($validate->isUpdate());
$this->repository->edit($id,$data);
return app('json')->success('编辑成功');
}
public function delete($id)
{
$where = [
$this->repository->getPk() => $id,
'mer_id' => $this->request->merId()
];
$this->repository->delete($where);
return app('json')->success('删除成功');
}
public function switchStatus($id)
{
$status = $this->request->param('status', 0) == 1 ? 1 : 0;
if(!$this->repository->detail($this->request->merId(),$id))
return app('json')->fail('数据不存在');
$this->repository->update($id, ['is_show' => $status]);
app()->make(SpuRepository::class)->changeStatus($id,3);
return app('json')->success('修改成功');
}
public function checkParams(StoreProductAssistValidate $validate)
{
$params = [
"image", "slider_image", "store_name", "store_info", "product_id","is_show","temp_id","attrValue","guarantee_template_id",
"start_time", "end_time", "assist_user_count", "assist_count", "status","pay_count","product_status","sort",'mer_labels','delivery_way','delivery_free',
];
$data = $this->request->params($params);
foreach ($data['attrValue'] as $datum) {
if ($datum['stock'] > $datum['old_stock']) throw new ValidateException('限量不能大于库存');
}
$validate->check($data);
return $data;
}
public function updateSort($id)
{
$sort = $this->request->param('sort');
$this->repository->updateSort($id,$this->request->merId(),['sort' => $sort]);
return app('json')->success('修改成功');
}
public function preview(ProductRepository $repository)
{
$data = $this->request->param();
$data['merchant'] = [
'mer_name' => $this->request->merchant()->mer_name,
'is_trader' => $this->request->merchant()->is_trader,
'mer_avatar' => $this->request->merchant()->mer_avatar,
'product_score' => $this->request->merchant()->product_score,
'service_score' => $this->request->merchant()->service_score,
'postage_score' => $this->request->merchant()->postage_score,
'service_phone' => $this->request->merchant()->service_phone,
'care_count' => $this->request->merchant()->care_count,
'type_name' => $this->request->merchant()->type_name->type_name ?? '',
'care' => true,
'recommend' => $this->request->merchant()->recommend,
];
$data['mer_id'] = $this->request->merId();
$data['status'] = 1;
$data['mer_status'] = 1;
$data['rate'] = 3;
return app('json')->success($repository->preview($data));
}
public function setLabels($id)
{
$data = $this->request->params(['mer_labels']);
// if (empty($data['mer_labels'])) return app('json')->fail('标签为空');
app()->make(SpuRepository::class)->setLabels($id,3,$data,$this->request->merId());
return app('json')->success('修改成功');
}
}

View File

@ -0,0 +1,70 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\product;
use app\common\repositories\store\product\ProductAssistSetRepository as repository;
use app\common\repositories\store\product\ProductAssistUserRepository;
use crmeb\basic\BaseController;
use think\App;
use app\validate\supply\StoreProductAssistValidate;
class ProductAssistSet extends BaseController
{
protected $repository ;
/**
* Product constructor.
* @param App $app
* @param repository $repository
*/
public function __construct(App $app ,repository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
/**
* TODO 列表
* @return mixed
* @author Qinii
* @day 2020-10-12
*/
public function lst()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['keyword','status','type','date','user_name']);
$where['mer_id'] = $this->request->merId();
return app('json')->success($this->repository->getMerchantList($where,$page,$limit));
}
/**
* TODO 详情
* @param $id
* @return mixed
* @author Qinii
* @day 2020-10-12
*/
public function detail($id)
{
[$page, $limit] = $this->getPage();
$where['product_assist_set_id'] = $id;
if(!$this->repository->getWhere(['product_assist_set_id' => $id,'mer_id' => $this->request->merId()]))
return app('json')->fail('数据不存在');
$make = app()->make(ProductAssistUserRepository::class);
return app('json')->success($make->userList($where,$page,$limit));
}
}

View File

@ -0,0 +1,87 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\product;
use app\common\repositories\system\supply\SupplyRepository;
use think\App;
use crmeb\basic\BaseController;
use app\common\repositories\store\product\ProductCopyRepository as repository;
class ProductCopy extends BaseController
{
/**
* @var repository
*/
protected $repository;
/**
* ProductCopy constructor.
* @param App $app
* @param repository $repository
*/
public function __construct(App $app ,repository $repository)
{
$this->repository = $repository;
parent::__construct($app);
}
/**
* TODO 列表
* @return mixed
* @author Qinii
* @day 2020-08-14
*/
public function lst()
{
[$page, $limit] = $this->getPage();
$where['mer_id'] = $this->request->param('mer_id');
$mer_id = $this->request->merId();
if ($mer_id){
$where['mer_id'] = $this->request->merId();
}
$where['type'] = $this->request->param('type','copy');
return app('json')->success($this->repository->getList($where,$page, $limit));
}
/**
* TODO
* @return mixed
* @author Qinii
* @day 2020-08-07
*/
public function count()
{
$count = $this->request->merchant()->copy_product_num;
return app('json')->success(['count' => $count]);
}
/**
* TODO 复制商品
* @return mixed
* @author Qinii
* @day 2020-08-06
*/
public function get()
{
$status = systemConfig('copy_product_status');
if($status == 0) return app('json')->fail('请前往平台后台-设置-第三方接口-开启采集');
$num = app()->make(SupplyRepository::class)->getCopyNum($this->request->merId());
if($num <= 0) return app('json')->fail('复制商品次数已用完');
$url = $this->request->param('url');
if (!$url) return app('json')->fail('请输入采集链接');
$res = $this->repository->getProduct($url,$this->request->merId());
return app('json')->success($res);
}
}

View File

@ -0,0 +1,155 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\product;
use app\common\repositories\store\product\ProductRepository;
use app\common\repositories\store\product\SpuRepository;
use think\App;
use crmeb\basic\BaseController;
use app\common\repositories\store\product\ProductGroupRepository;
use app\validate\supply\StoreProductGroupValidate;
use think\exception\ValidateException;
class ProductGroup extends BaseController
{
protected $repository ;
/**
* ProductGroup constructor.
* @param App $app
* @param ProductGroupRepository $repository
*/
public function __construct(App $app ,ProductGroupRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
public function lst()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['product_status','keyword','active_type','status','us_status','product_group_id','mer_labels']);
$where['is_show'] = $where['status'];
unset($where['status']);
$where['mer_id'] = $this->request->merId();
return app('json')->success($this->repository->getMerchantList($where,$page,$limit));
}
public function create(StoreProductGroupValidate $validate)
{
$data = $this->checkParams($validate);
$this->repository->create($this->request->merId(),$data);
return app('json')->success('添加成功');
}
public function detail($id)
{
$where = [
$this->repository->getPk() => $id,
'mer_id' => $this->request->merId()
];
if(!$this->repository->getWhere($where))
return app('json')->fail('数据不存在');
$data = $this->repository->detail($this->request->merId(),$id);
return app('json')->success($data);
}
public function delete($id)
{
$where = [
$this->repository->getPk() => $id,
'mer_id' => $this->request->merId()
];
if(!$this->repository->getWhere($where))
return app('json')->fail('数据不存在');
$this->repository->update($id,['is_del' => 1]);
event('product.groupDelete',compact('id'));
app()->make(SpuRepository::class)->changeStatus($id,4);
return app('json')->success('删除成功');
}
public function update($id,StoreProductGroupValidate $validate)
{
$data = $this->checkParams($validate);
$where = [
$this->repository->getPk() => $id,
'mer_id' => $this->request->merId()
];
if(!$this->repository->getWhere($where))
return app('json')->fail('数据不存在');
$this->repository->edit($id,$data);
return app('json')->success('编辑成功');
}
public function switchStatus($id)
{
$status = $this->request->param('status', 0) == 1 ? 1 : 0;
if(!$this->repository->detail($this->request->merId(),$id))
return app('json')->fail('数据不存在');
$this->repository->update($id, ['is_show' => $status]);
app()->make(SpuRepository::class)->changeStatus($id,4);
return app('json')->success('修改成功');
}
public function checkParams(StoreProductGroupValidate $validate)
{
$params = [
"image", "slider_image", "store_name", "store_info", "product_id","is_show","temp_id","once_pay_count","guarantee_template_id",
"start_time", "end_time", "buying_num", "buying_count_num", "status","pay_count","time","ficti_status","ficti_num","attrValue",
'unit_name','content','sort','mer_labels','delivery_way','delivery_free'
];
$data = $this->request->params($params);
if($data['buying_count_num'] < 2) throw new ValidateException('开团人数不得少于2人');
if($data['end_time'] < $data['start_time']) throw new ValidateException('活动开始时间必须大于结束时间');
$validate->check($data);
return $data;
}
public function updateSort($id)
{
$sort = $this->request->param('sort');
$this->repository->updateSort($id,$this->request->merId(),['sort' => $sort]);
return app('json')->success('修改成功');
}
public function preview(ProductRepository $repository)
{
$data = $this->request->param();
$data['merchant'] = [
'mer_name' => $this->request->merchant()->mer_name,
'is_trader' => $this->request->merchant()->is_trader,
'mer_avatar' => $this->request->merchant()->mer_avatar,
'product_score' => $this->request->merchant()->product_score,
'service_score' => $this->request->merchant()->service_score,
'postage_score' => $this->request->merchant()->postage_score,
'service_phone' => $this->request->merchant()->service_phone,
'care_count' => $this->request->merchant()->care_count,
'type_name' => $this->request->merchant()->type_name->type_name ?? '',
'care' => true,
'recommend' => $this->request->merchant()->recommend,
];
$data['mer_id'] = $this->request->merId();
$data['status'] = 1;
$data['mer_status'] = 1;
$data['rate'] = 3;
return app('json')->success($repository->preview($data));
}
public function setLabels($id)
{
$data = $this->request->params(['mer_labels']);
// if (empty($data['mer_labels'])) return app('json')->fail('标签为空');
app()->make(SpuRepository::class)->setLabels($id,4,$data,$this->request->merId());
return app('json')->success('修改成功');
}
}

View File

@ -0,0 +1,66 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\product;
use app\common\repositories\store\product\ProductGroupUserRepository;
use think\App;
use crmeb\basic\BaseController;
use app\common\repositories\store\product\ProductGroupBuyingRepository;
class ProductGroupBuying extends BaseController
{
protected $repository ;
/**
* ProductGroup constructor.
* @param App $app
* @param ProductGroupBuyingRepository $repository
*/
public function __construct(App $app ,ProductGroupBuyingRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
/**
* TODO 团列表
* @return \think\response\Json
* @author Qinii
* @day 1/12/21
*/
public function lst()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['keyword','status','date','user_name']);
$where['mer_id'] = $this->request->merId();
$data = $this->repository->getMerchantList($where,$page,$limit);
return app('json')->success($data);
}
/**
* TODO 团成员列表
* @param $id
* @return \think\response\Json
* @author Qinii
* @day 1/12/21
*/
public function detail($id)
{
[$page, $limit] = $this->getPage();
if(!$this->repository->get($id))
return app('json')->fail('数据不存在');
$where = ['group_buying_id' => $id];
$list = app()->make(ProductGroupUserRepository::class)->getAdminList($where,$page,$limit);
return app('json')->success($list);
}
}

View File

@ -0,0 +1,109 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\product;
use app\common\repositories\store\product\ProductLabelRepository;
use app\validate\admin\ProductLabelValidate;
use think\App;
use crmeb\basic\BaseController;
class ProductLabel extends BaseController
{
protected $repository;
public function __construct(App $app, ProductLabelRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
public function lst()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['name', 'type', 'status']);
$where['mer_id'] = $this->request->merId();
$data = $this->repository->getList($where,$page, $limit);
return app('json')->success($data);
}
public function createForm()
{
return app('json')->success(formToData($this->repository->form(null, 'merchantStoreProductLabelCreate')));
}
public function create(ProductLabelValidate $validate)
{
$data = $this->checkParams($validate);
if (!$this->repository->check($data['label_name'], $this->request->merId()))
return app('json')->fail('名称重复');
$data['mer_id'] = $this->request->merId();
$this->repository->create($data);
return app('json')->success('添加成功');
}
public function updateForm($id)
{
return app('json')->success(formToData($this->repository->updateForm($id, 'merchantStoreProductLabelUpdate', $this->request->merId())));
}
public function update($id, ProductLabelValidate $validate)
{
$data = $this->checkParams($validate);
if (!$this->repository->check($data['label_name'], $this->request->merId(),$id))
return app('json')->fail('名称重复');
$getOne = $this->repository->getWhere(['product_label_id' => $id,'mer_id' => $this->request->merId()]);
if (!$getOne) return app('json')->fail('数据不存在');
$this->repository->update($id, $data);
return app('json')->success('编辑成功');
}
public function detail($id)
{
$getOne = $this->repository->getWhere(['product_label_id' => $id,'mer_id' => $this->request->merId(), 'is_del' => 0]);
if (!$getOne) return app('json')->fail('数据不存在');
return app('json')->success($getOne);
}
public function delete($id)
{
$getOne = $this->repository->getWhere(['product_label_id' => $id,'mer_id' => $this->request->merId()]);
if (!$getOne) return app('json')->fail('数据不存在');
$this->repository->delete($id);
return app('json')->success('删除成功');
}
public function switchWithStatus($id)
{
$status = $this->request->param('status') == 1 ? 1 : 0;
$getOne = $this->repository->getWhere(['product_label_id' => $id,'mer_id' => $this->request->merId()]);
if (!$getOne) return app('json')->fail('数据不存在');
$this->repository->update($id,['status' => $status]);
return app('json')->success('修改成功');
}
public function getOptions()
{
$data = $this->repository->getOptions($this->request->merId());
return app('json')->success($data);
}
public function checkParams(ProductLabelValidate $validate)
{
$params = ['label_name', 'status', 'sort', 'info'];
$data = $this->request->params($params);
$validate->check($data);
return $data;
}
}

View File

@ -0,0 +1,181 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\product;
use app\common\repositories\store\product\ProductPresellRepository as repository;
use app\common\repositories\store\product\ProductRepository;
use app\common\repositories\store\product\SpuRepository;
use crmeb\basic\BaseController;
use think\App;
use app\validate\supply\StoreProductPresellValidate;
use think\exception\ValidateException;
class ProductPresell extends BaseController
{
protected $repository;
/**
* Product constructor.
* @param App $app
* @param repository $repository
*/
public function __construct(App $app, repository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
/**
* TODO 列表
* @return mixed
* @author Qinii
* @day 2020-10-12
*/
public function lst()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['product_status', 'keyword', 'type', 'presell_type', 'is_show', 'us_status','product_presell_id','mer_labels']);
$where['mer_id'] = $this->request->merId();
return app('json')->success($this->repository->getMerchantList($where, $page, $limit));
}
/**
* TODO 添加
* @param StoreProductPresellValidate $validate
* @return mixed
* @author Qinii
* @day 2020-10-12
*/
public function create(StoreProductPresellValidate $validate)
{
$data = $this->checkParams($validate);
$this->repository->create($this->request->merId(), $data);
return app('json')->success('添加成功');
}
/**
* TODO 详情
* @param $id
* @return mixed
* @author Qinii
* @day 2020-10-12
*/
public function detail($id)
{
$data = $this->repository->detail($this->request->merId(), $id);
return app('json')->success($data);
}
/**
* TODO
* @param $id
* @param StoreProductPresellValidate $validate
* @return mixed
* @author Qinii
* @day 2020-10-13
*/
public function update($id, StoreProductPresellValidate $validate)
{
$data = $this->checkParams($validate);
$where = [
$this->repository->getPk() => $id,
'mer_id' => $this->request->merId()
];
if (!$this->repository->getWhere($where))
return app('json')->fail('数据不存在');
$data['mer_id'] = $this->request->merId();
$this->repository->edit($id, $data);
return app('json')->success('编辑成功');
}
public function delete($id)
{
$where = [
$this->repository->getPk() => $id,
'mer_id' => $this->request->merId()
];
$this->repository->delete($where);
return app('json')->success('删除成功');
}
public function switchStatus($id)
{
$status = $this->request->param('status', 0) == 1 ? 1 : 0;
if (!$this->repository->detail($this->request->merId(), $id))
return app('json')->fail('数据不存在');
$this->repository->update($id, ['is_show' => $status]);
app()->make(SpuRepository::class)->changeStatus($id,2);
return app('json')->success('修改成功');
}
public function number()
{
return app('json')->success($this->repository->stat($this->request->merId()));
}
public function checkParams(StoreProductPresellValidate $validate)
{
$params = [
"image", "slider_image", "store_name", "store_info", "product_id", "is_show", "temp_id", "attrValue","sort","guarantee_template_id",
"start_time", "end_time", "final_start_time", "final_end_time", "status", "presell_type", 'pay_count', "delivery_type", "delivery_day",
"product_status",'mer_labels','delivery_way','delivery_free'
];
$data = $this->request->params($params);
foreach ($data['attrValue'] as $datum) {
if ($datum['stock'] > $datum['old_stock']) throw new ValidateException('限量不能大于库存');
}
$validate->check($data);
return $data;
}
public function updateSort($id)
{
$sort = $this->request->param('sort');
$this->repository->updateSort($id, $this->request->merId(), ['sort' => $sort]);
return app('json')->success('修改成功');
}
public function preview(ProductRepository $repository)
{
$data = $this->request->param();
$data['merchant'] = [
'mer_name' => $this->request->merchant()->mer_name,
'is_trader' => $this->request->merchant()->is_trader,
'mer_avatar' => $this->request->merchant()->mer_avatar,
'product_score' => $this->request->merchant()->product_score,
'service_score' => $this->request->merchant()->service_score,
'postage_score' => $this->request->merchant()->postage_score,
'service_phone' => $this->request->merchant()->service_phone,
'care_count' => $this->request->merchant()->care_count,
'type_name' => $this->request->merchant()->type_name->type_name ?? '',
'care' => true,
'recommend' => $this->request->merchant()->recommend,
];
$data['mer_id'] = $this->request->merId();
$data['status'] = 1;
$data['mer_status'] = 1;
$data['rate'] = 3;
return app('json')->success($repository->preview($data));
}
public function setLabels($id)
{
$data = $this->request->params(['mer_labels']);
// if (empty($data['mer_labels'])) return app('json')->fail('标签为空');
app()->make(SpuRepository::class)->setLabels($id,2,$data,$this->request->merId());
return app('json')->success('修改成功');
}
}

View File

@ -0,0 +1,268 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\product;
use app\common\repositories\store\product\ProductLabelRepository;
use app\common\repositories\store\product\SpuRepository;
use app\common\repositories\store\StoreSeckillActiveRepository;
use app\common\repositories\store\StoreSeckillTimeRepository;
use think\App;
use crmeb\basic\BaseController;
use app\validate\supply\StoreSeckillProductValidate as validate;
use app\common\repositories\store\product\ProductRepository as repository;
use think\exception\ValidateException;
class ProductSeckill extends BaseController
{
protected $repository ;
/**
* Product constructor.
* @param App $app
* @param repository $repository
*/
public function __construct(App $app ,repository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
/**
* @Author:Qinii
* @Date: 2020/5/18
* @return mixed
*/
public function lst()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['cate_id','keyword','mer_cate_id','seckill_status','us_status','product_id','mer_labels']);
$type = $this->request->param('type',1);
$where = array_merge($where,$this->repository->switchType($type,$this->request->merId(),1));
return app('json')->success($this->repository->getSeckillList($this->request->merId(),$where, $page, $limit));
}
/**
* @Author:Qinii
* @Date: 2020/5/18
* @param $id
* @return mixed
*/
public function detail($id)
{
if(!$this->repository->merExists($this->request->merId(),$id))
return app('json')->fail('数据不存在');
return app('json')->success($this->repository->getAdminOneProduct($id,null));
}
/**
* @Author:Qinii
* @Date: 2020/5/18
* @param validate $validate
* @return mixed
*/
public function create(validate $validate)
{
$data = $this->checkParams($validate);
$data['start_time'] = (int)substr($data['start_time'],0,2);
$data['end_time'] = (int)substr($data['end_time'],0,2);
$merchant = $this->request->merchant();
$data['product_type'] = 1;
$data['mer_id'] = $this->request->merId();
$data['status'] = 0;
$data['is_gift_bag'] = 0;
$data['mer_status'] = ($merchant['is_del'] || !$merchant['mer_state'] || !$merchant['status']) ? 0 : 1;
$this->repository->create($data,1);
return app('json')->success('添加成功');
}
/**
* TODO 商品验证
* @param $data
* @author Qinii
* @day 2020-08-01
*/
public function check($data)
{
if($data['brand_id'] != 0 && !$this->repository->merBrandExists($data['brand_id']))
throw new ValidateException('品牌不存在');
if(!$this->repository->CatExists($data['cate_id']))
throw new ValidateException('平台分类不存在');
if(isset($data['mer_cate_id']) && !$this->repository->merCatExists($data['mer_cate_id'],$this->request->merId()))
throw new ValidateException('不存在的商户分类');
if($data['delivery_way'] == 2 && !$this->repository->merShippingExists($this->request->merId(),$data['temp_id']))
throw new ValidateException('运费模板不存在');
$make = app()->make(StoreSeckillTimeRepository::class);
$_count = $make->getWhereCount(['start_time' => $data['start_time'],'end_time' => $data['end_time']]);
if(!$_count) throw new ValidateException('时间段未开放活动');
}
/**
* @Author:Qinii
* @Date: 2020/5/18
* @param $id
* @param validate $validate
* @return mixed
*/
public function update($id,validate $validate)
{
$data = $this->checkParams($validate);
$merchant = $this->request->merchant();
if(!$this->repository->merExists($this->request->merId(),$id)) return app('json')->fail('数据不存在');
$this->check($data);
$data['status'] = 0;
$data['mer_status'] = ($merchant['is_del'] || !$merchant['mer_state'] || !$merchant['status']) ? 0 : 1;
unset($data['old_product_id']);
$data['is_gift_bag'] = 0;
$this->repository->edit($id,$data,$this->request->merId(),1);
return app('json')->success('编辑成功');
}
/**
* TODO
* @param $id
* @return mixed
* @author Qinii
* @day 2020-08-07
*/
public function delete($id)
{
if(!$this->repository->merExists($this->request->merId(),$id))
return app('json')->fail('数据不存在');
if($this->repository->getWhereCount(['product_id' => $id,'is_show' => 1,'status' => 1]))
return app('json')->fail('商品上架中');
$this->repository->delete($id);
return app('json')->success('转入回收站');
}
public function destory($id)
{
if(!$this->repository->merDeleteExists($this->request->merId(),$id))
return app('json')->fail('只能删除回收站的商品');
$this->repository->destory($id);
return app('json')->success('删除成功');
}
/**
* @Author:Qinii
* @Date: 2020/5/18
* @param int $id
* @return mixed
*/
public function switchStatus($id)
{
$status = $this->request->param('status', 0) == 1 ? 1 : 0;
if(!$this->repository->merExists($this->request->merId(),$id))
return app('json')->fail('数据不存在');
$this->repository->switchShow($id, $status,'is_show',$this->request->merId());
return app('json')->success('修改成功');
}
/**
* @Author:Qinii
* @Date: 2020/5/18
* @return mixed
*/
public function getStatusFilter()
{
return app('json')->success($this->repository->getFilter($this->request->merId(),'秒杀商品',1));
}
/**
* @Author:Qinii
* @Date: 2020/5/8
* @Time: 14:39
* @param validate $validate
* @return array
*/
public function checkParams(validate $validate)
{
$params = array_merge($this->repository::CREATE_PARAMS,["start_day","end_day", "start_time","end_time","once_count","all_pay_count", "once_pay_count","old_product_id"]);
$data = $this->request->params($params);
$data['product_type'] = 1;
app()->make(ProductLabelRepository::class)->checkHas($this->request->merId(),$data['mer_labels']);
$validate->check($data);
$data['start_time'] = (int)substr($data['start_time'],0,2);
$data['end_time'] = (int)substr($data['end_time'],0,2);
return $data;
}
/**
* TODO
* @param $id
* @return mixed
* @author Qinii
* @day 2020-07-03
*/
public function restore($id)
{
if(!$this->repository->merDeleteExists($this->request->merId(),$id))
return app('json')->fail('只能删除回收站的商品');
$this->repository->restore($id);
return app('json')->success('商品已恢复');
}
/**
* TODO 获取可用时间段
* @return mixed
* @author Qinii
* @day 2020-08-03
*/
public function lst_time()
{
return app('json')->success(app()->make(StoreSeckillTimeRepository::class)->select());
}
public function updateSort($id)
{
$sort = $this->request->param('sort');
app()->make(StoreSeckillActiveRepository::class);
$this->repository->updateSort($id,$this->request->merId(),['sort' => $sort]);
return app('json')->success('修改成功');
}
public function preview()
{
$data = $this->request->param();
$data['merchant'] = [
'mer_name' => $this->request->merchant()->mer_name,
'is_trader' => $this->request->merchant()->is_trader,
'mer_avatar' => $this->request->merchant()->mer_avatar,
'product_score' => $this->request->merchant()->product_score,
'service_score' => $this->request->merchant()->service_score,
'postage_score' => $this->request->merchant()->postage_score,
'service_phone' => $this->request->merchant()->service_phone,
'care_count' => $this->request->merchant()->care_count,
'type_name' => $this->request->merchant()->type_name->type_name ?? '',
'care' => true,
'recommend' => $this->request->merchant()->recommend,
];
$data['mer_id'] = $this->request->merId();
$data['status'] = 1;
$data['mer_status'] = 1;
$data['rate'] = 3;
return app('json')->success($this->repository->preview($data));
}
public function setLabels($id)
{
$data = $this->request->params(['mer_labels']);
// if (empty($data['mer_labels'])) return app('json')->fail('标签为空');
app()->make(SpuRepository::class)->setLabels($id,1,$data,$this->request->merId());
return app('json')->success('修改成功');
}
}

View File

@ -0,0 +1,79 @@
<?php
namespace app\validate\supply\store\product;
use app\common\repositories\store\product\ProductUnitRepository as repository;
use app\validate\admin\ProductUnitValidate;
use crmeb\basic\BaseController;
use think\App;
class ProductUnit extends BaseController
{
protected $repository;
/**
* Product constructor.
* @param App $app
* @param repository $repository
*/
public function __construct(App $app, repository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
public function list()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['value']);
$where['mer_id'] = $this->request->merId();
$data = $this->repository->list($where, $page, $limit);
return app('json')->success($data);
}
public function createForm()
{
return app('json')->success(formToData($this->repository->createForm($this->request->merId())));
}
public function create(ProductUnitValidate $validate)
{
$data = $this->checkParams($validate);
$this->repository->create($this->request->merId(), $data);
return app('json')->success('添加成功');
}
public function updateForm($id)
{
return app('json')->success(formToData($this->repository->updateForm((int)$id, $this->request->merId())));
}
public function update($id, ProductUnitValidate $validate)
{
$data = $this->checkParams($validate);
$this->repository->update($id, $this->request->merId(), $data);
return app('json')->success('编辑成功');
}
public function delete($id)
{
$this->repository->delete($id, $this->request->merId());
return app('json')->success('删除成功');
}
public function getSelectList()
{
return app('json')->success($this->repository->getSelectList($this->request->merId()));
}
public function checkParams(ProductUnitValidate $validate)
{
$params = ['value', 'sort'];
$data = $this->request->params($params);
$validate->check($data);
return $data;
}
}

View File

@ -0,0 +1,292 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\service;
use app\common\repositories\store\service\StoreServiceLogRepository;
use app\common\repositories\store\service\StoreServiceRepository;
use app\common\repositories\user\UserRepository;
use app\validate\supply\StoreServiceValidate;
use crmeb\basic\BaseController;
use FormBuilder\Exception\FormBuilderException;
use think\App;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\exception\ValidateException;
/**
* Class StoreService
* @package app\controller\supply\store\service
* @author xaboy
* @day 2020/5/29
*/
class StoreService extends BaseController
{
/**
* @var StoreServiceRepository
*/
protected $repository;
/**
* @var StoreServiceLogRepository
*/
protected $logRepository;
/**
* StoreService constructor.
* @param App $app
* @param StoreServiceRepository $repository
*/
public function __construct(App $app, StoreServiceRepository $repository, StoreServiceLogRepository $logRepository)
{
parent::__construct($app);
$this->repository = $repository;
$this->logRepository = $logRepository;
}
/**
* @return mixed
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
* @author xaboy
* @day 2020/5/29
*/
public function lst()
{
$where = $this->request->params(['keyword', 'status']);
[$page, $limit] = $this->getPage();
$where['mer_id'] = $this->request->merId();
return app('json')->success($this->repository->getList($where, $page, $limit));
}
/**
* @return mixed
* @throws FormBuilderException
* @author xaboy
* @day 2020/5/29
*/
public function createForm()
{
return app('json')->success(formToData($this->repository->form($this->request->merId())));
}
/**
* @param StoreServiceValidate $validate
* @return mixed
* @author xaboy
* @day 2020/5/29
*/
public function create(StoreServiceValidate $validate)
{
$data = $this->checkParams($validate);
$data['mer_id'] = $this->request->merId();
if ($this->repository->issetService($data['mer_id'], $data['uid']))
return app('json')->fail('该用户已绑定客服');
if ($this->repository->fieldExists('account', $data['account'])) {
return app('json')->fail('账号已存在');
}
$data['pwd'] = password_hash($data['pwd'], PASSWORD_BCRYPT);
$this->repository->create($data);
return app('json')->success('添加成功');
}
/**
* @param StoreServiceValidate $validate
* @return array
* @author xaboy
* @day 2020/5/29
*/
public function checkParams(StoreServiceValidate $validate, $isUpdate = false)
{
$data = $this->request->params([['uid', []], 'nickname', 'account', 'pwd', 'confirm_pwd', 'is_open', 'status', 'customer', 'is_verify', 'is_goods', 'notify', 'avatar', 'phone', ['sort', 0]]);
if ($isUpdate) {
$validate->update();
}
if (!$this->request->merId()) {
$data['is_verify'] = 0;
$data['customer'] = 0;
$data['is_goods'] = 0;
$data['notify'] = 0;
$data['phone'] = '';
}
$validate->check($data);
if (!$data['avatar']) $data['avatar'] = $data['uid']['src'];
if ($data['pwd'] && $data['pwd'] != $data['confirm_pwd']) {
throw new ValidateException('客服密码与确认密码不一致');
}
$data['uid'] = $data['uid']['id'];
unset($data['confirm_pwd']);
return $data;
}
/**
* @param $id
* @return mixed
* @throws FormBuilderException
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
* @author xaboy
* @day 2020/5/29
*/
public function updateForm($id)
{
if (!$this->repository->merExists($this->request->merId(), $id))
return app('json')->fail('数据不存在');
return app('json')->success(formToData($this->repository->updateForm($id)));
}
/**
* @param $id
* @param StoreServiceValidate $validate
* @return mixed
* @throws DbException
* @author xaboy
* @day 2020/5/29
*/
public function update($id, StoreServiceValidate $validate)
{
$data = $this->checkParams($validate, true);
if (!$this->repository->merExists($merId = $this->request->merId(), $id))
return app('json')->fail('数据不存在');
if ($this->repository->issetService($merId, $data['uid'], $id))
return app('json')->fail('该用户已绑定客服');
if ($this->repository->fieldExists('account', $data['account'], $id)) {
return app('json')->fail('账号已存在');
}
if ($data['pwd']) {
$data['pwd'] = password_hash($data['pwd'], PASSWORD_BCRYPT);
} else {
unset($data['pwd']);
}
$this->repository->update($id, $data);
return app('json')->success('修改成功');
}
/**
* @param int $id
* @return mixed
* @throws DbException
* @author xaboy
* @day 2020/5/29
*/
public function changeStatus($id)
{
$status = $this->request->param('status');
if (!$this->repository->merExists($this->request->merId(), $id))
return app('json')->fail('数据不存在');
$this->repository->update($id, ['is_open' => $status == 1 ? 1 : 0]);
return app('json')->success('修改成功');
}
/**
* @param $id
* @return mixed
* @throws DbException
* @author xaboy
* @day 2020/5/29
*/
public function delete($id)
{
if (!$this->repository->merExists($this->request->merId(), $id))
return app('json')->fail('数据不存在');
$this->repository->delete($id);
return app('json')->success('删除成功');
}
/**
* TODO 客服的全部用户
* @param $id
* @return mixed
* @author Qinii
* @day 2020-06-18
*/
public function serviceUserList($id)
{
if (!$this->repository->merExists($this->request->merId(), $id))
return app('json')->fail('数据不存在');
[$page, $limit] = $this->getPage();
return app('json')->success($this->logRepository->getServiceUserList($id, $page, $limit));
}
/**
* TODO 商户的全部用户列表
* @return mixed
* @author Qinii
* @day 2020-06-19
*/
public function merchantUserList()
{
[$page, $limit] = $this->getPage();
return app('json')->success($this->logRepository->getMerchantUserList($this->request->merId(), $page, $limit));
}
/**
* TODO 用户与客服聊天记录
* @param $id
* @param $uid
* @return mixed
* @author Qinii
* @day 2020-06-19
*/
public function getUserMsnByService($id, $uid)
{
[$page, $limit] = $this->getPage();
if (!$this->repository->getWhereCount(['service_id' => $id, 'mer_id' => $this->request->merId()]))
return app('json')->fail('客服不存在');
return app('json')->success($this->logRepository->getUserMsn($uid, $page, $limit, $this->request->merId(), $id));
}
/**
* TODO 用户与商户聊天记录
* @param $id
* @return mixed
* @author Qinii
* @day 2020-06-19
*/
public function getUserMsnByMerchant($id)
{
[$page, $limit] = $this->getPage();
return app('json')->success($this->logRepository->getUserMsn($id, $page, $limit, $this->request->merId()));
}
public function getUserList()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['nickname']);
$where['status'] = 1;
$data = app()->make(UserRepository::class)->getPulbicLst($where, $page, $limit);
return app('json')->success($data);
}
public function login($id)
{
if (!$this->repository->merExists($this->request->merId(), $id))
return app('json')->fail('数据不存在');
$adminInfo = $this->repository->get($id);
$tokenInfo = $this->repository->createToken($adminInfo);
$admin = $adminInfo->toArray();
unset($admin['pwd']);
$data = [
'token' => $tokenInfo['token'],
'exp' => $tokenInfo['out'],
'admin' => $admin,
'url' => '/' . config('admin.service_prefix')
];
return app('json')->success($data);
}
}

View File

@ -0,0 +1,92 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\service;
use app\common\repositories\store\service\StoreServiceReplyRepository;
use app\validate\supply\ServiceReplyValidate;
use crmeb\basic\BaseController;
use think\App;
class StoreServiceReply extends BaseController
{
/**
* @var StoreServiceReplyRepository
*/
protected $repository;
/**
* StoreService constructor.
* @param App $app
* @param StoreServiceReplyRepository $repository
*/
public function __construct(App $app, StoreServiceReplyRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
public function lst()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['keyword', 'status']);
$where['mer_id'] = $this->request->merId();
return app('json')->success($this->repository->getList($where, $page, $limit));
}
public function create()
{
$data = $this->checkParams();
$this->repository->create($data);
return app('json')->success('添加成功');
}
public function update($id)
{
$data = $this->checkParams();
if (!$this->repository->existsWhere(['mer_id' => $data['mer_id'], 'service_reply_id' => $id])) {
return app('json')->fail('数据不存在');
}
$this->repository->update($id, $data);
return app('json')->success('修改成功');
}
public function delete($id)
{
if (!$this->repository->existsWhere(['mer_id' => $this->request->merId(), 'service_reply_id' => $id])) {
return app('json')->fail('数据不存在');
}
$this->repository->delete((int)$id);
return app('json')->success('删除成功');
}
public function changeStatus($id)
{
$data = $this->request->params(['status']);
if (!$this->repository->existsWhere(['mer_id' => $this->request->merId(), 'service_reply_id' => $id])) {
return app('json')->fail('数据不存在');
}
$this->repository->update($id, $data);
return app('json')->success('修改成功');
}
public function checkParams()
{
$data = $this->request->params(['keyword', 'status', 'content', 'type']);
app()->make(ServiceReplyValidate::class)->check($data);
$data['mer_id'] = $this->request->merId();
return $data;
}
}

View File

@ -0,0 +1,229 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\shipping;
use app\common\repositories\store\CityAreaRepository;
use Overtrue\Pinyin\Pinyin;
use think\App;
use crmeb\basic\BaseController;
use app\common\repositories\store\shipping\CityRepository as repository;
use think\facade\Log;
class City extends BaseController
{
protected $repository;
/**
* City constructor.
* @param App $app
* @param repository $repository
*/
public function __construct(App $app, repository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
/**
* @Author:Qinii
* @Date: 2020/5/8
* @Time: 14:40
* @return mixed
*/
public function lst()
{
return app('json')->success($this->repository->getFormatList([['is_show', '=', 1],['level','<',2]]));
}
public function lstV2($pid)
{
return app('json')->success(app()->make(CityAreaRepository::class)->getChildren(intval($pid)));
}
public function cityList()
{
$address = $this->request->param('address');
if (!$address)
return app('json')->fail('地址不存在');
$make = app()->make(CityAreaRepository::class);
$city = $make->search(compact('address'))->order('id DESC')->find();
if (!$city){
Log::info('用户定位对比失败,请在城市数据中增加:'.var_export($address,true));
return app('json')->fail('地址不存在');
}
return app('json')->success($make->getCityList($city));
}
/**
* @return mixed
* @author Qinii
*/
public function getlist()
{
return app('json')->success($this->repository->getFormatList(['is_show' => 1]));
}
public function lstV3()
{
$provinceCode = $this->request->param('province_code') ?? '';
$cityCode = $this->request->param('city_code') ?? '';
$areaCode = $this->request->param('area_code') ?? '';
$streetCode = $this->request->param('street_code') ?? '';
$pinyin = $this->request->param('pinyin') ?? 0;
/** @var CityAreaRepository $repo */
$repo = app()->make(CityAreaRepository::class);
$list = $repo->getGeoChildren(['province_code' => $provinceCode, 'city_code' => $cityCode, 'area_code' => $areaCode, 'street_code' => $streetCode]);
$geoList = [];
$pyList = [];
foreach ($list as $v) {
$temp = [];
if (!empty($v['village_id'])) {
if ($pinyin == 1) {
$py = strtoupper((new Pinyin)->abbr($v['village_name'])[0] ?? '-');
$pyList[$py][] = [
'type' => 'village',
'id' => $v['village_id'],
'level' => 5,
'name' => $v['village_name'] ?? '',
'code' => $v['village_code'] ?? ''
];
} else {
$temp = [
'type' => 'village',
'id' => $v['village_id'],
'level' => 5,
'name' => $v['village_name'] ?? '',
'code' => $v['village_code'] ?? ''
];
$geoList[] = $temp;
}
}
if (!empty($v['street_id'])) {
if ($pinyin == 1) {
$py = strtoupper((new Pinyin)->abbr($v['street_name'])[0] ?? '-');
$pyList[$py][] = [
'type' => 'street',
'id' => $v['street_id'],
'level' => 4,
'name' => $v['street_name'] ?? '',
'code' => $v['street_code'] ?? ''
];
} else {
$temp = [
'type' => 'street',
'id' => $v['street_id'],
'level' => 4,
'name' => $v['street_name'] ?? '',
'code' => $v['street_code'] ?? ''
];
$geoList[] = $temp;
}
}
if (!empty($v['area_id'])) {
if ($pinyin == 1) {
$py = strtoupper((new Pinyin)->abbr($v['area_name'])[0] ?? '-');
$pyList[$py][] = [
'type' => 'area',
'id' => $v['area_id'],
'level' => 3,
'name' => $v['area_name'] ?? '',
'code' => $v['area_code'] ?? ''
];
} else {
$temp = [
'type' => 'area',
'id' => $v['area_id'],
'level' => 3,
'name' => $v['area_name'] ?? '',
'code' => $v['area_code'] ?? ''
];
$geoList[] = $temp;
}
}
if (!empty($v['city_id'])) {
if ($pinyin == 1) {
$py = strtoupper((new Pinyin)->abbr($v['city_name'])[0] ?? '-');
$pyList[$py][] = [
'type' => 'city',
'id' => $v['city_id'],
'level' => 2,
'name' => $v['city_name'] ?? '',
'code' => $v['city_code'] ?? ''
];
} else {
$temp = [
'type' => 'city',
'id' => $v['city_id'],
'level' => 2,
'name' => $v['city_name'] ?? '',
'code' => $v['city_code'] ?? '',
];
$geoList[] = $temp;
}
}
if (!empty($v['province_id'])) {
if ($pinyin == 1) {
$py = strtoupper((new Pinyin)->abbr($v['province_name'])[0] ?? '-');
$pyList[$py][] = [
'type' => 'province',
'id' => $v['province_id'],
'level' => 1,
'name' => $v['province_name'] ?? '',
'code' => $v['province_code'] ?? ''
];
} else {
$temp = [
'type' => 'province',
'id' => $v['province_id'],
'level' => 1,
'name' => $v['province_name'] ?? '',
'code' => $v['province_code'] ?? ''
];
$geoList[] = $temp;
}
}
}
if ($pinyin == 1) {
$geoList = [];
foreach($pyList as $k=>$v) {
$temp = [];
$temp['pinyin'] = $k;
$temp['data'] = $pyList[$k];
$geoList[] = $temp;
}
}
return app('json')->success($geoList);
}
public function brigade()
{
/** @var CityAreaRepository $repo */
$repo = app()->make(CityAreaRepository::class);
$list = $repo->getBrigade([]);
$geoList = [];
foreach ($list as $v) {
$temp = [
'type' => 'brigade',
'id' => $v['id'],
'level' => 6,
'name' => $v['brigade_name'] ?? '',
'code' => $v['brigade_name'] ?? ''
];
$geoList[] = $temp;
}
return app('json')->success($geoList);
}
}

View File

@ -0,0 +1,156 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\shipping;
use think\App;
use crmeb\basic\BaseController;
use app\validate\supply\ShippingTemplateValidate as validate;
use app\common\repositories\store\shipping\ShippingTemplateRepository as repository;
class ShippingTemplate extends BaseController
{
protected $repository;
/**
* ShippingTemplate constructor.
* @param App $app
* @param repository $repository
*/
public function __construct(App $app, repository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
/**
* @Author:Qinii
* @Date: 2020/5/8
* @Time: 14:39
* @return mixed
*/
public function lst()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['type','name']);
return app('json')->success($this->repository->search($this->request->merId(),$where, $page, $limit));
}
/**
* @Author:Qinii
* @Date: 2020/5/18
* @return mixed
*/
public function getList()
{
return app('json')->success($this->repository->getList($this->request->merId()));
}
/**
* @Author:Qinii
* @Date: 2020/5/8
* @Time: 14:39
* @param validate $validate
* @return mixed
*/
public function create(validate $validate)
{
$data = $this->checkParams($validate);
$data['mer_id'] = $this->request->merId();
$this->repository->create($data);
return app('json')->success('添加成功');
}
/**
* @Author:Qinii
* @Date: 2020/5/8
* @Time: 14:39
* @param $id
* @return mixed
*/
public function detail($id)
{
if(!$this->repository->merExists($this->request->merId(),$id))
return app('json')->fail('数据不存在');
return app('json')->success($this->repository->getOne($id));
}
/**
* @Author:Qinii
* @Date: 2020/5/8
* @Time: 14:39
* @param $id
* @param validate $validate
* @return mixed
*/
public function update($id,validate $validate)
{
$data = $this->checkParams($validate);
if(!$this->repository->merExists($this->request->merId(),$id))
return app('json')->fail('数据不存在');
$this->repository->update($id,$data,$this->request->merId());
return app('json')->success('编辑成功');
}
/**
* @Author:Qinii
* @Date: 2020/5/8
* @Time: 14:39
* @param $id
* @return mixed
*/
public function delete($id)
{
if(!$this->repository->merExists($this->request->merId(),$id))
return app('json')->fail('数据不存在');
if($this->repository->merDefaultExists($this->request->merId(),$id))
return app('json')->fail('默认模板不能删除');
if($this->repository->getProductUse($this->request->merId(),$id))
return app('json')->fail('模板使用中,不能删除');
$this->repository->delete($id);
return app('json')->success('删除成功');
}
/**
* @Author:Qinii
* @Date: 2020/5/8
* @Time: 14:39
* @param validate $validate
* @return array
*/
public function checkParams(validate $validate)
{
$data = $this->request->params(['name','type','appoint','undelivery','region','free','undelives','sort','info']);
$validate->check($data);
return $data;
}
/**
* 设置默认模板
* @param $id
* @return \think\response\Json
*
* @date 2023/10/07
* @author yyw
*/
public function setDefault($id)
{
if (!$this->repository->merExists($this->request->merId(), $id))
return app('json')->fail('数据不存在');
if ($this->repository->merDefaultExists($this->request->merId(), $id))
return app('json')->fail('当前模板已是默认模板了');
$this->repository->setDefault($this->request->merId(), $id);
return app('json')->success('设置成功');
}
}

View File

@ -0,0 +1,49 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\shipping;
use think\App;
use crmeb\basic\BaseController;
use app\common\repositories\store\shipping\ShippingTemplateFreeRepository as repository;
class ShippingTemplateFree extends BaseController
{
protected $repository;
/**
* ShippingTemplateFree constructor.
* @param App $app
* @param repository $repository
*/
public function __construct(App $app, repository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
/**
* @Author:Qinii
* @Date: 2020/5/8
* @Time: 14:38
* @param $id
* @return mixed
*/
public function delete($id)
{
if(!$this->repository->merExists($this->request->merId(),$id))
return app('json')->fail('数据不存在');
$this->repository->delete($id);
return app('json')->success('删除成功') ;
}
}

View File

@ -0,0 +1,49 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\shipping;
use think\App;
use crmeb\basic\BaseController;
use app\common\repositories\store\shipping\ShippingTemplateRegionRepository as repository;
class ShippingTemplateRegion extends BaseController
{
protected $repository;
/**
* ShippingTemplateRegion constructor.
* @param App $app
* @param repository $repository
*/
public function __construct(App $app, repository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
/**
* @Author:Qinii
* @Date: 2020/5/8
* @Time: 14:39
* @param $id
* @return mixed
*/
public function delete($id)
{
if(!$this->repository->merExists($this->request->merId(),$id))
return app('json')->fail('数据不存在');
$this->repository->delete($id);
return app('json')->success('删除成功') ;
}
}

View File

@ -0,0 +1,49 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\store\shipping;
use think\App;
use crmeb\basic\BaseController;
use app\common\repositories\store\shipping\ShippingTemplateUndeliveRepository as repository;
class ShippingTemplateUndelive extends BaseController
{
protected $repository;
/**
* ShippingTemplateUndelive constructor.
* @param App $app
* @param repository $repository
*/
public function __construct(App $app, repository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
/**
* @Author:Qinii
* @Date: 2020/5/8
* @Time: 14:39
* @param $id
* @return mixed
*/
public function delete($id)
{
if(!$this->repository->merExists($this->request->merId(),$id))
return app('json')->fail('数据不存在');
$this->repository->delete($id);
return app('json')->success('删除成功') ;
}
}

View File

@ -0,0 +1,216 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\system;
use app\common\repositories\store\MerchantTakeRepository;
use app\common\repositories\store\product\ProductRepository;
use app\common\repositories\system\config\ConfigValueRepository;
use app\common\repositories\system\operate\OperateLogRepository;
use app\common\repositories\system\serve\ServeOrderRepository;
use app\common\repositories\user\UserBillRepository;
use app\validate\merchant\MerchantTakeValidate;
use crmeb\basic\BaseController;
use app\common\repositories\system\merchant\MerchantRepository;
use app\validate\merchant\MerchantUpdateValidate;
use crmeb\jobs\ChangeMerchantStatusJob;
use think\App;
use think\facade\Queue;
/**
* Class Merchant
* @package app\controller\merchant\system
* @author xaboy
* @day 2020/6/25
*/
class Merchant extends BaseController
{
/**
* @var MerchantRepository
*/
protected $repository;
/**
* Merchant constructor.
* @param App $app
* @param MerchantRepository $repository
*/
public function __construct(App $app, MerchantRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
/**
* @return mixed
* @throws \FormBuilder\Exception\FormBuilderException
* @author xaboy
* @day 2020/6/25
*/
public function updateForm()
{
return app('json')->success(formToData($this->repository->merchantForm($this->request->merchant()->toArray())));
}
/**
* @param MerchantUpdateValidate $validate
* @return mixed
* @author xaboy
* @day 2020/6/25
*/
public function update(MerchantUpdateValidate $validate, MerchantTakeValidate $takeValidate, MerchantTakeRepository $repository)
{
$type = $this->request->param('type',1);
$merchant = $this->request->merchant();
if ($type == 2) {
$data = $this->request->params([
'mer_info',
'mer_certificate',
'service_phone',
'mer_avatar',
'mer_banner',
'mer_state',
'mini_banner',
'mer_keyword',
'mer_address',
'long',
'lat',
['delivery_way',[2]],
['services_type',0],
]);
$validate->check($data);
$sys_bases_status = systemConfig('sys_bases_status') === '0' ? 0 : 1;
if ($sys_bases_status && empty($data['mer_certificate']))
return app('json')->fail('店铺资质不可为空');
app()->make(ConfigValueRepository::class)->setFormData([
'mer_certificate' => $data['mer_certificate'],
'services_type' => $data['services_type']
], $this->request->merId());
unset($data['mer_certificate'], $data['services_type']);
foreach ($data['delivery_way'] as $datum) {
if ($datum == 1) {
$takeData = $this->request->params(['mer_take_status', 'mer_take_name', 'mer_take_phone', 'mer_take_address', 'mer_take_location', 'mer_take_day', 'mer_take_time']);
$takeValidate->check($takeData);
$repository->set($this->request->merId(), $takeData);
break;
}
}
$delivery_way = implode(',',$data['delivery_way']);
if (count($data['delivery_way']) == 1 && $data['delivery_way'] != $merchant->delivery_way) {
app()->make(ProductRepository::class)->getSearch([])
->where('mer_id',$merchant->mer_id)
->update(['delivery_way' => $delivery_way]);
}
$data['delivery_way'] = $delivery_way;
} else {
$data = $this->request->params(['mer_state']);
if ($merchant->is_margin == 1 && $data['mer_state'] == 1)
return app('json')->fail('开启店铺前请先支付保证金');
if ($data['mer_state'] && !$merchant->sub_mchid && systemConfig('open_wx_combine'))
return app('json')->fail('开启店铺前请先完成微信子商户入驻');
}
$merchant->save($data);
// 商户编辑记录日志
event('create_operate_log', [
'category' => OperateLogRepository::MERCHANT_EDIT_AUDIT_STATUS,
'data' => [
'merchant' => $merchant,
'admin_info' => $this->request->adminInfo(),
'update_infos' => ['status' => $data['mer_state']]
],
]);
Queue::push(ChangeMerchantStatusJob::class, $this->request->merId());
return app('json')->success('修改成功');
}
/**
* @return mixed
* @author xaboy
* @day 2020/7/21
*/
public function info(MerchantTakeRepository $repository)
{
$merchant = $this->request->merchant();
$adminInfo = $this->request->adminInfo();
$append = ['merchantCategory', 'merchantType', 'mer_certificate','margin_remind_status'];
if ($merchant->is_margin == -10)
$append[] = 'refundMarginOrder';
$data = $merchant->append($append)->hidden(['mark', 'reg_admin_id', 'sort'])->toArray();
$delivery = $repository->get($this->request->merId()) + systemConfig(['tx_map_key']);
$data = array_merge($data,$delivery);
$data['sys_bases_status'] = systemConfig('sys_bases_status') === '0' ? 0 : 1;
$data['services_type'] = (int)merchantConfig((int)$merchant->mer_id,'services_type');
$data['mer_account'] = $adminInfo['account'];
return app('json')->success($data);
}
/**
* @param MerchantTakeRepository $repository
* @return mixed
* @author xaboy
* @day 2020/8/1
*/
public function takeInfo(MerchantTakeRepository $repository)
{
$merId = $this->request->merId();
return app('json')->success($repository->get($merId) + systemConfig(['tx_map_key']));
}
/**
* @param MerchantTakeValidate $validate
* @param MerchantTakeRepository $repository
* @return mixed
* @author xaboy
* @day 2020/8/1
*/
public function take(MerchantTakeValidate $validate, MerchantTakeRepository $repository)
{
$data = $this->request->params(['mer_take_status', 'mer_take_name', 'mer_take_phone', 'mer_take_address', 'mer_take_location', 'mer_take_day', 'mer_take_time']);
$validate->check($data);
$repository->set($this->request->merId(), $data);
return app('json')->success('设置成功');
}
public function getMarginQrCode()
{
$data['pay_type'] = 1;
$data['type'] = $this->request->param('type',10);
$res = app()->make(ServeOrderRepository::class)->QrCode($this->request->merId(), 'margin', $data);
return app('json')->success($res);
}
public function getMarginLst()
{
[$page, $limit] = $this->getPage();
$where = [
'mer_id' => $this->request->merId(),
'category' => 'mer_margin'
];
$data = app()->make(UserBillRepository::class)->getLst($where, $page, $limit);
return app('json')->success($data);
}
}

View File

@ -0,0 +1,137 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\system;
use app\validate\merchant\MerchantApplymentsValidate;
use think\App;
use think\facade\Config;
use think\facade\Queue;
use crmeb\basic\BaseController;
use app\common\repositories\system\merchant\MerchantApplymentsRepository;
class MerchantApplyments extends BaseController
{
/**
* @var MerchantRepository
*/
protected $repository;
/**
* Merchant constructor.
* @param App $app
* @param MerchantRepository $repository
*/
public function __construct(App $app, MerchantApplymentsRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
/**
* TODO 创建申请
* @param MerchantApplymentsValidate $validate
* @return \think\response\Json
* @author Qinii
* @day 6/22/21
*/
public function create(MerchantApplymentsValidate $validate)
{
if(!systemConfig('open_wx_sub_mch')) return app('json')->fail('未开启子商户入驻');
$data = $this->checkParams($validate);
$this->repository->create($data,$this->request->merId());
return app('json')->success('申请提交成功');
}
public function detail()
{
$merId = $this->request->merId();
$data = $this->repository->detail($merId);
$data['open_wx_sub_mch'] = systemConfig('open_wx_sub_mch');
return app('json')->success($data);
}
public function update($id,MerchantApplymentsValidate $validate)
{
if(!systemConfig('open_wx_sub_mch')) return app('json')->fail('未开启子商户入驻');
$data = $this->checkParams($validate);
unset($data['id']);
$this->repository->edit($id,$data);
return app('json')->success('编辑提交成功');
}
public function check()
{
$mer_id = $this->request->merId();
$this->repository->check($mer_id);
return app('json')->success('查询状态已更新');
}
public function uploadImage($field)
{
$file = $this->request->file($field);
$water = $this->request->param('water');
if (!$file) return app('json')->fail('请上传图片');
$file = is_array($file) ? $file[0] : $file;
validate(["$field|图片" => [
'fileSize' => config('upload.filesize'),
'fileExt' => 'jpg,jpeg,png,bmp,gif',
'fileMime' => 'image/jpeg,image/png,image/gif',
function ($file) {
$ext = $file->extension();
if ($ext != strtolower($file->extension())) {
return '图片后缀必须为小写';
}
return true;
}
]])->check([$field => $file]);
$res = $this->repository->uploadImage($field,$water);
return app('json')->success($res);
}
public function checkParams(MerchantApplymentsValidate $validate)
{
//'organization_cert_info',
$data = $this->request->params([
'organization_type','business_license_info','id_doc_type','id_card_info','id_doc_info','need_account_info','account_info','contact_info','sales_scene_info','merchant_shortname','qualifications','business_addition_pics','business_addition_desc'
]);
if($data['id_doc_type'] == 1){
unset($data['id_doc_info']);
}else{
unset($data['id_card_info']);
}
if(in_array($data['organization_type'],['2401','2500'])){
unset($data['business_license_info']);
// unset($data['organization_cert_info']);
}
// if(isset($data['organization_cert_info']) && !is_array($data['organization_cert_info'])) unset($data['organization_cert_info']);
if(isset($data['qualifications']) && !$data['qualifications']) unset($data['qualifications']);
if(isset($data['business_addition_pics']) && !$data['business_addition_pics']) unset($data['business_addition_pics']);
if($data['organization_type'] !== 2 && isset($data['id_card_info']['id_card_address'])){
unset($data['id_card_info']['id_card_address']);
}
$validate->check($data);
return $data;
}
}

View File

@ -0,0 +1,120 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\system\admin;
use crmeb\basic\BaseController;
use app\common\repositories\system\supply\SupplyAdminRepository;
use app\validate\admin\LoginValidate;
use Gregwar\Captcha\CaptchaBuilder;
use Gregwar\Captcha\PhraseBuilder;
use think\App;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\facade\Cache;
class Login extends BaseController
{
protected $repository;
public function __construct(App $app, SupplyAdminRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
/**
* TODO 判断是否需要滑块验证码
* @return \think\response\Json
* @author Qinii
* @day 2022/10/11
*/
public function ajCaptchaStatus()
{
$data = $this->request->params(['account']);
$key = 'mer_login_failuree_'.$data['account'];
$numb = (Cache::get($key) ?? 0);
return app('json')->success(['status' => $numb > 2 ]);
}
/**
* @param LoginValidate $validate
* @return mixed
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
* @author xaboy
* @day 2020-04-10
*/
public function login(LoginValidate $validate)
{
$data = $this->request->params(['account', 'password', 'code', 'key',['captchaType', ''], ['captchaVerification', ''],'token']);
$validate->check($data);
//图形验证码废弃
// if(Cache::get('mer_login_freeze_'.$data['account']))
// return app('json')->fail('账号或密码错误次数太多,请稍后在尝试');
// $this->repository->checkCode($data['key'], $data['code']);
$key = 'mer_login_failuree_'.$data['account'];
$numb = (Cache::get($key) ?? 0);
if($numb > 2){
if (!$data['captchaType'] || !$data['captchaVerification'])
return app('json')->fail('请滑动滑块验证');
try {
aj_captcha_check_two($data['captchaType'], $data['captchaVerification']);
} catch (\Throwable $e) {
return app('json')->fail($e->getMessage());
}
}
$adminInfo = $this->repository->login($data['account'], $data['password']);
$tokenInfo = $this->repository->createToken($adminInfo);
$admin = $adminInfo->toArray();
unset($admin['pwd']);
$data = [
'token' => $tokenInfo['token'],
'exp' => $tokenInfo['out'],
'admin' => $admin
];
Cache::delete($key);
return app('json')->success($data);
}
/**
* @return mixed
* @author xaboy
* @day 2020-04-10
*/
public function logout()
{
if ($this->request->isLogin())
$this->repository->clearToken($this->request->token());
return app('json')->success('退出登录');
}
/**
* @return mixed
* @author xaboy
* @day 2020-04-09
*/
public function getCaptcha()
{
$codeBuilder = new CaptchaBuilder(null, new PhraseBuilder(4));
$key = $this->repository->createLoginKey($codeBuilder->getPhrase());
$captcha = $codeBuilder->build()->inline();
return app('json')->success(compact('key', 'captcha'));
}
}

View File

@ -0,0 +1,288 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\system\admin;
use app\common\repositories\system\auth\RoleRepository;
use crmeb\basic\BaseController;
use app\common\repositories\system\supply\SupplyAdminRepository;
use app\validate\admin\AdminEditValidate;
use app\validate\admin\AdminValidate;
use FormBuilder\Exception\FormBuilderException;
use think\App;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
/**
* Class SupplyAdmin
* @package app\controller\admin\system\admin
* @author xaboy
* @day 2020-04-18
*/
class SupplyAdmin extends BaseController
{
/**
* @var SupplyAdminRepository
*/
protected $repository;
/**
* @var int
*/
protected $merId;
/**
* SupplyAdmin constructor.
* @param App $app
* @param SupplyAdminRepository $repository
*/
public function __construct(App $app, SupplyAdminRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
$this->merId = $this->request->merId();
}
/**
* @return mixed
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
* @author xaboy
* @day 2020-04-18
*/
public function getList()
{
$where = $this->request->params(['keyword', 'date', 'status']);
[$page, $limit] = $this->getPage();
return app('json')->success($this->repository->getList($this->merId, $where, $page, $limit));
}
/**
* @param int $id
* @return mixed
* @throws DbException
* @author xaboy
* @day 2020-04-18
*/
public function switchStatus($id)
{
$status = $this->request->param('status');
if (!$this->repository->exists($id, $this->merId, 1))
return app('json')->fail('数据不存在');
$this->repository->update($id, ['status' => $status == 1 ? 1 : 0]);
return app('json')->success('编辑成功');
}
/**
* @return mixed
* @throws FormBuilderException
* @author xaboy
* @day 2020-04-18
*/
public function createForm()
{
return app('json')->success(formToData($this->repository->form($this->merId)));
}
/**
* @param int $id
* @return mixed
* @throws DataNotFoundException
* @throws DbException
* @throws FormBuilderException
* @throws ModelNotFoundException
* @author xaboy
* @day 2020-04-18
*/
public function updateForm($id)
{
if (!$this->repository->exists($id, $this->merId, 1))
return app('json')->fail('数据不存在');
return app('json')->success(formToData($this->repository->updateForm($this->merId, $id)));
}
/**
* @param int $id
* @return mixed
* @throws FormBuilderException
* @author xaboy
* @day 2020-04-18
*/
public function passwordForm($id)
{
if (!$this->repository->exists($id, $this->merId))
return app('json')->fail('数据不存在');
return app('json')->success(formToData($this->repository->passwordForm($id)));
}
/**
* @param AdminValidate $validate
* @return mixed
* @author xaboy
* @day 2020-04-18
*/
public function create(AdminValidate $validate)
{
$data = $this->request->params(['account', 'phone', 'pwd', 'againPassword', 'real_name', ['roles', []], ['status', 0]]);
$validate->check($data);
if ($data['pwd'] !== $data['againPassword'])
return app('json')->fail('两次密码输入不一致');
unset($data['againPassword']);
if ($this->repository->merFieldExists($this->merId, 'account', $data['account']))
return app('json')->fail('账号已存在');
$data['pwd'] = $this->repository->passwordEncode($data['pwd']);
$data['mer_id'] = $this->merId;
$data['level'] = 1;
$check = app()->make(RoleRepository::class)->checkRole($data['roles'],$this->merId);
if (!$check ) {
return app('json')->fail('未开启或者不存在的身份不能添加');
}
$this->repository->create($data);
return app('json')->success('添加成功');
}
/**
* @param int $id
* @param AdminValidate $validate
* @return mixed
* @throws DbException
* @author xaboy
* @day 2020-04-18
*/
public function update($id, AdminValidate $validate)
{
$data = $this->request->params(['account', 'phone', 'real_name', ['roles', []], ['status', 0]]);
$validate->isUpdate()->check($data);
if ($this->repository->merFieldExists($this->merId, 'account', $data['account'], $id))
return app('json')->fail('账号已存在');
$check = app()->make(RoleRepository::class)->checkRole($data['roles'],$this->merId);
if (!$check ) {
return app('json')->fail('未开启或者不存在的身份不能添加');
}
$this->repository->update($id, $data);
return app('json')->success('编辑成功');
}
/**
* @param int $id
* @param AdminValidate $validate
* @return mixed
* @throws DbException
* @author xaboy
* @day 2020-04-18
*/
public function password($id, AdminValidate $validate)
{
$data = $this->request->params(['pwd', 'againPassword']);
$validate->isPassword()->check($data);
if ($data['pwd'] !== $data['againPassword'])
return app('json')->fail('两次密码输入不一致');
if (!$this->repository->exists($id, $this->merId))
return app('json')->fail('管理员不存在');
$data['pwd'] = $this->repository->passwordEncode($data['pwd']);
unset($data['againPassword']);
$this->repository->update($id, $data);
return app('json')->success('修改密码成功');
}
/**
* @param int $id
* @return mixed
* @throws DbException
* @author xaboy
* @day 2020-04-18
*/
public function delete($id)
{
if (!$this->repository->exists($id, $this->merId, 1))
return app('json')->fail('数据不存在');
$this->repository->update($id, ['is_del' => 1]);
return app('json')->success('删除成功');
}
/**
* @param AdminEditValidate $validate
* @return mixed
* @throws DbException
* @author xaboy
* @day 2020-04-20
*/
public function edit(AdminEditValidate $validate)
{
$data = $this->request->params(['real_name', 'phone']);
$validate->check($data);
$this->repository->update($this->request->adminId(), $data);
return app('json')->success('修改成功');
}
/**
* @return mixed
* @throws FormBuilderException
* @author xaboy
* @day 2020-04-20
*/
public function editForm()
{
$adminInfo = $this->request->adminInfo();
return app('json')->success(formToData($this->repository->editForm(['real_name' => $adminInfo->real_name, 'phone' => $adminInfo->phone])));
}
/**
* @param AdminValidate $validate
* @return mixed
* @throws DbException
* @author xaboy
* @day 2020-04-20
*/
public function editPassword(AdminValidate $validate)
{
$data = $this->request->params(['pwd', 'againPassword']);
$validate->isPassword()->check($data);
if ($data['pwd'] !== $data['againPassword'])
return app('json')->fail('两次密码输入不一致');
$data['pwd'] = $this->repository->passwordEncode($data['pwd']);
unset($data['againPassword']);
$this->repository->update($this->request->adminId(), $data);
return app('json')->success('修改密码成功');
}
/**
* @return mixed
* @throws FormBuilderException
* @author xaboy
* @day 2020-04-20
*/
public function editPasswordForm()
{
return app('json')->success(formToData($this->repository->passwordForm($this->request->adminId(), 3)));
}
}

View File

@ -0,0 +1,155 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\system\auth;
use crmeb\basic\BaseController;
use app\common\repositories\system\auth\RoleRepository;
use app\validate\admin\RoleValidate;
use FormBuilder\Exception\FormBuilderException;
use think\App;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
class Role extends BaseController
{
protected $repository;
public function __construct(App $app, RoleRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
/**
* @return mixed
* @throws FormBuilderException
* @author xaboy
* @day 2020-04-18
*/
public function createForm()
{
$merchant = $this->request->merchant();
return app('json')->success(formToData($this->repository->form((int)$merchant->type_id)));
}
/**
* @param int $id
* @return mixed
* @throws DataNotFoundException
* @throws DbException
* @throws FormBuilderException
* @throws ModelNotFoundException
* @author xaboy
* @day 2020-04-18
*/
public function updateForm($id)
{
if (!$this->repository->merExists($this->request->merId(), $id))
return app('json')->fail('数据不存在');
$merchant = $this->request->merchant();
return app('json')->success(formToData($this->repository->updateForm((int)$merchant->type_id, $id)));
}
/**
* @return mixed
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
* @author xaboy
* @day 2020-04-18
*/
public function getList()
{
[$page, $limit] = $this->getPage();
return app('json')->success($this->repository->search($this->request->merId(), [], $page, $limit));
}
/**
* @param int $id
* @return mixed
* @throws DbException
* @author xaboy
* @day 2020-04-09
*/
public function switchStatus($id)
{
$status = $this->request->param('status');
if (!$this->repository->merExists($this->request->merId(), $id))
return app('json')->fail('数据不存在');
$this->repository->update($id, ['status' => $status == 1 ? 1 : 0]);
return app('json')->success('编辑成功');
}
/**
* @param int $id
* @return mixed
* @throws DbException
* @author xaboy
* @day 2020-04-18
*/
public function delete($id)
{
if (!$this->repository->merExists($this->request->merId(), $id))
return app('json')->fail('数据不存在');
$this->repository->delete($id);
return app('json')->success('删除成功');
}
/**
* @param RoleValidate $validate
* @return mixed
* @author xaboy
* @day 2020-04-18
*/
public function create(RoleValidate $validate)
{
$data = $this->checkParam($validate);
$data['mer_id'] = $this->request->merId();
$this->repository->create($data);
return app('json')->success('添加成功');
}
/**
* @param int $id
* @param RoleValidate $validate
* @return mixed
* @throws DbException
* @author xaboy
* @day 2020-04-18
*/
public function update($id, RoleValidate $validate)
{
$data = $this->checkParam($validate);
if (!$this->repository->merExists($this->request->merId(), $id))
return app('json')->fail('数据不存在');
$this->repository->update($id, $data);
return app('json')->success('编辑成功');
}
/**
* @param RoleValidate $validate
* @return array
* @author xaboy
* @day 2020-04-18
*/
private function checkParam(RoleValidate $validate)
{
$data = $this->request->params(['role_name', ['rules', []], ['status', 0]]);
$validate->check($data);
return $data;
}
}

View File

@ -0,0 +1,348 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\system\diy;
use app\common\repositories\article\ArticleRepository;
use app\common\repositories\store\product\ProductRepository;
use app\common\repositories\store\product\SpuRepository;
use app\common\repositories\store\StoreCategoryRepository;
use app\common\repositories\system\diy\DiyRepository;
use crmeb\basic\BaseController;
use think\App;
use think\exception\ValidateException;
class Diy extends BaseController
{
protected $repository;
public function __construct(App $app, DiyRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
/**
* DIY列表
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function lst()
{
$where = $this->request->params([
['status', ''],
['name', ''],
['version', ''],
['is_diy',1],
]);
[$page, $limit] = $this->getPage();
$where['mer_id'] = $this->request->merId();
$where['type'] = 2;
$data = $this->repository->getMerchantList($where, $page, $limit);
return app('json')->success($data);
}
/**
* TODO 平台给的默认模板
* @return \think\response\Json
* @author Qinii
* @day 2023/9/4
*/
public function defaultLst()
{
[$page, $limit] = $this->getPage();
$where['default_ids'] = $this->repository->withMerSearch([
'mer_id' => $this->request->merId(),
'type_id'=> $this->request->merchant()->type_id,
'category_id'=> $this->request->merchant()->category_id,
'is_trader'=> $this->request->merchant()->is_trader,
]);
$data = $this->repository->getMerchantDefaultList($where, $page, $limit);
return app('json')->success($data);
}
/**
* 保存资源
* @param int $id
* @return mixed
*/
public function saveData(int $id = 0)
{
// 0.全部店铺使用、1. 指定店铺使用、2. 指定商户分类使用、3. 指定店铺类型使用、4. 指定商户类别使用
$data = $this->request->params([
['name', ''],
['title', ''],
['value', ''],
['type', '2'],
['cover_image', ''],
['is_show', 0],
['is_bg_color', 0],
['is_bg_pic', 0],
['bg_tab_val', 0],
['color_picker', ''],
['bg_pic', ''],
['is_diy',1],
]);
$data['mer_id'] = $this->request->merId();
$value = is_string($data['value']) ? json_decode($data['value'], true) : $data['value'];
$infoDiy = $id ? $this->repository->getWhere(['id' => $id, 'mer_id' => $data['mer_id']]) : [];
if ($infoDiy && $infoDiy['is_default'])
return app('json')->fail('默认模板不能修改');
if ($infoDiy) {
foreach ($value as $k => $item) {
if ($item['name'] === 'goodList') {
if (isset($item['selectConfig']['list'])) {
unset($item['selectConfig']['list']);
}
if (isset($item['goodsList']['list']) && is_array($item['goodsList']['list'])) {
$item['goodsList']['ids'] = array_column($item['goodsList']['list'], 'product_id');
unset($item['goodsList']['list']);
}
} elseif ($item['name'] === 'articleList') {
if (isset($item['selectList']['list']) && is_array($item['selectList']['list'])) {
unset($item['selectList']['list']);
}
} elseif ($item['name'] === 'promotionList') {
unset($item['productList']['list']);
}
$value[$k] = $item;
}
$data['value'] = json_encode($value);
} else {
if (isset($value['d_goodList']['selectConfig']['list'])) {
unset($value['d_goodList']['selectConfig']['list']);
} elseif (isset($value['d_goodList']['goodsList']['list'])) {
$limitMax = config('database.page.limitMax', 50);
if (isset($value['d_goodList']['numConfig']['val']) && isset($value['d_goodList']['tabConfig']['tabVal']) && $value['d_goodList']['tabConfig']['tabVal'] == 0 && $value['d_goodList']['numConfig']['val'] > $limitMax) {
return app('json')->fail('您设置得商品个数超出系统限制,最大限制' . $limitMax . '个商品');
}
$value['d_goodList']['goodsList']['ids'] = array_column($value['d_goodList']['goodsList']['list'], 'product_id');
unset($value['d_goodList']['goodsList']['list']);
} elseif (isset($value['k_newProduct']['goodsList']['list'])) {
$list = [];
foreach ($value['k_newProduct']['goodsList']['list'] as $item) {
$list[] = [
'image' => $item['image'],
'store_info' => $item['store_info'],
'store_name' => $item['store_name'],
'id' => $item['id'],
'price' => $item['price'],
'ot_price' => $item['ot_price'],
];
}
$value['k_newProduct']['goodsList']['list'] = $list;
} elseif (isset($value['selectList']['list']) && is_array($value['selectList']['list'])) {
unset($value['goodsList']['list']);
}
$data['value'] = json_encode($value, JSON_UNESCAPED_UNICODE);
}
$data['version'] = '1.0';
return app('json')->success($id ? '修改成功' : '保存成功',
['id' => $this->repository->saveData($id, $data)]
);
}
public function select()
{
$where = ['is_diy' => 0, 'is_del' => 0];
$data = $this->repository->getOptions($where);
return app('json')->success($data);
}
/**
* 删除模板
* @param $id
* @return mixed
*/
public function del($id)
{
$this->repository->del($id,$this->request->merId());
return app('json')->success('删除成功');
}
/**
* 使用模板
* @param $id
* @return mixed
*/
public function setStatus($id)
{
// TODO 使用模板时取消复制
// $res = $this->repository->get($id);
// if ($res['is_default'] == 1) {
// $ret = $this->repository->copy($id,$this->request->merId());
// $id = $ret['id'];
// }
$this->repository->setUsed($id,$this->request->merId());
return app('json')->success('修改成功');
}
/**
* 获取一条数据
* @param int $id
* @return mixed
*/
public function getInfo(int $id)
{
if (!$id)return app('json')->fail('参数错误');
$info = $this->repository->getWhere([$this->repository->getPk() => $id, 'mer_id' => $this->request->merId(),'is_default' => 0], '*');
if ($info) {
$info = $info->toArray();
} else {
return app('json')->fail('模板不存在');
}
$info['value'] = json_decode($info['value'], true);
if ($info['value']) {
$articleServices = app()->make(ArticleRepository::class);
if ($info['is_diy']) {
foreach ($info['value'] as &$item) {
if ($item['name'] === 'goodList' && isset($item['goodsList']['ids']) && count($item['goodsList']['ids'])) {
$item['goodsList']['list'] = app()->make(SpuRepository::class)->search(['product_ids' => $item['goodsList']['ids']])->select();
} elseif ($item['name'] === 'articleList') {//文章
$data = [];
if ($item['selectConfig']['activeValue'] ?? 0) {
$data = $articleServices->search(0,['cid' => $item['selectConfig']['activeValue'] ?? 0], 0, $item['numConfig']['val'] ?? 10);
$data = $data['list'];
}
$item['selectList']['list'] = $data['list'] ?? [];
} elseif ($item['name'] === 'promotionList') {//活动模仿
$data = [];
if (isset($item['tabConfig']['tabCur']) && $typeArr = $item['tabConfig']['list'][$item['tabConfig']['tabCur']] ?? []) {
$val = $typeArr['link']['activeVal'] ?? 0;
if ($val) {
$data = $this->get_groom_list($val, (int)($item['numConfig']['val'] ?? 0));
}
}
$item['productList']['list'] = $data;
}
}
} else {
if ($info['value']) {
if (isset($info['value']['d_goodList']['goodsList'])) {
$info['value']['d_goodList']['goodsList']['list'] = [];
}
if (isset($info['value']['d_goodList']['goodsList']['ids']) && count($info['value']['d_goodList']['goodsList']['ids'])) {
$info['value']['d_goodList']['goodsList']['list'] = app()->make(SpuRepository::class)->getApiSearch(['product_ids' => $info['value']['d_goodList']['goodsList']['ids']],1,10);
}
}
}
}
return app('json')->success(compact('info'));
}
/**
* 设置模版默认数据
* @param $id
* @return mixed
*/
public function setDefaultData($id)
{
if (!$id) return app('json')->fail('参数错误');
$info = $this->repository->getWhere([$this->repository->getPk() => $id, 'mer_id' => $this->request->merId()]);
if ($info) {
if ($info->is_default) return app('json')->fail('默认模板不能修改');
$info->default_value = $info->value;
$info->update_time = time();
$info->save();
return app('json')->success('设置成功');
} else {
return app('json')->fail('模板不存在');
}
}
/**
* 还原模板数据
* @param $id
* @return mixed
*/
public function Recovery($id)
{
if (!$id) return app('json')->fail('参数错误');
$info = $this->repository->getWhere([$this->repository->getPk() => $id, 'mer_id' => $this->request->merId()]);
if ($info) {
if ($info->is_default) return app('json')->fail('默认模板不能修改');
$info->value = $info->default_value;
$info->update_time = time();
$info->save();
return app('json')->success('还原成功');
} else {
return app('json')->fail('模板不存在');
}
}
/**
* 实际获取方法
* @param $type
* @return array
*/
protected function get_groom_list($type, int $num = 0)
{
$services = app()->make(SpuRepository::class);
$info = [];
[$page, $limit] = $this->getPage();
$where['is_gift_bag'] = 0;
$where['order'] = 'star';
$where['product_type'] = 0;
if ($type == 1) {//TODO 精品推荐
$where['hot_type'] = 'best';
$info = $services->getApiSearch($where, $page, $limit, null);//TODO 精品推荐个数
} else if ($type == 2) {//TODO 热门榜单
$where['hot_type'] = 'hot';
$info = $services->getApiSearch($where, $page, $limit, null);//TODO 热门榜单 猜你喜欢
} else if ($type == 3) {//TODO 首发新品
$where['hot_type'] = 'new';
$info = $services->getApiSearch($where, $page, $limit, null);//TODO 首发新品
} else if ($type == 4) {//TODO 促销单品
$where['hot_type'] = 'good';
$info = $services->getApiSearch($where, $page, $limit, null);//TODO 促销单品
}
return $info;
}
public function productLst()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params([
['store_name',''],
['order', 'star'],
['cate_pid',0],
['star',''],
['product_type',0],
['mer_cate_id',''],
['cate_id',''],
'product_ids',
]);
$where['is_gift_bag'] = 0;
$where['keyword'] = $where['store_name'];
if ($this->request->merId()) $where['mer_id'] = $this->request->merId();
$data = app()->make(SpuRepository::class)->getApiSearch($where, $page, $limit, null);
return app('json')->success($data);
}
public function copy($id)
{
$data = $this->repository->copy($id,$this->request->merId());
return app('json')->success('复制模板成功',$data);
}
public function review($id)
{
$rest = $this->repository->get($id);
if (!$rest) return app('json')->fail('数据不存在');
$image = $this->repository->review($id,$this->request->merId());
return app('json')->success(compact('image'));
}
}

View File

@ -0,0 +1,181 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\system\financial;
use app\common\repositories\system\financial\FinancialRepository;
use app\validate\supply\MerchantFinancialAccountValidate;
use crmeb\basic\BaseController;
use crmeb\services\ExcelService;
use think\App;
class Financial extends BaseController
{
/**
* @var FinancialRepository
*/
protected $repository;
/**
* Merchant constructor.
* @param App $app
* @param FinancialRepository $repository
*/
public function __construct(App $app, FinancialRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
/**
* TODO 转账信息Form
* @param $id
* @return \think\response\Json
* @author Qinii
* @day 3/18/21
*/
public function accountForm()
{
return app('json')->success(formToData($this->repository->financialAccountForm($this->request->merId())));
}
/**
* TODO 转账信息保存
* @param MerchantFinancialAccountValidate $accountValidate
* @return \think\response\Json
* @author Qinii
* @day 3/18/21
*/
public function accountSave(MerchantFinancialAccountValidate $accountValidate)
{
$data = $this->request->params(['account','financial_type','name','bank','bank_code','wechat','wechat_code','alipay','alipay_code']); //idcard
$accountValidate->check($data);
$this->repository->saveAccount($this->request->merId(),$data);
return app('json')->success('保存成功');
}
/**
* TODO 申请转账form
* @return \think\response\Json
* @author Qinii
* @day 3/19/21
*/
public function createForm()
{
return app('json')->success(formToData($this->repository->applyForm($this->request->merId())));
}
/**
* TODO 申请转账保存
* @return \think\response\Json
* @author Qinii
* @day 3/19/21
*/
public function createSave()
{
$data = $this->request->param(['extract_money','financial_type','mark']);
$data['mer_admin_id'] = $this->request->adminId();
$this->repository->saveApply($this->request->merId(),$data);
return app('json')->success('保存成功');
}
/**
* TODO
* @return \think\response\Json
* @author Qinii
* @day 2023/6/10
*/
public function refundMargin()
{
return app('json')->success($this->repository->checkRefundMargin($this->request->merId(), $this->request->adminId()));
}
public function refundMarginApply()
{
$data = $this->request->params(['type','name','code','pic']);
$this->repository->refundMargin($this->request->merId(), $this->request->adminId(),$data);
return app('json')->success('提交成功');
}
/**
* TODO 列表
* @author Qinii
* @day 3/19/21
*/
public function lst()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['date','status','financial_type','financial_status','keyword']);
$where['keywords_'] = $where['keyword'];
unset($where['keyword']);
$where['mer_id'] = $this->request->merId();
$data = $this->repository->getAdminList($where,$page,$limit);
return app('json')->success($data);
}
/**
* TODO 取消申请
* @param $id
* @return \think\response\Json
* @author Qinii
* @day 3/19/21
*/
public function delete($id)
{
$this->repository->cancel($this->request->merId(),$id,['is_del' => 1]);
return app('json')->success('取消申请');
}
/**
* TODO
* @param $id
* @return \think\response\Json
* @author Qinii
* @day 3/19/21
*/
public function detail($id)
{
$data = $this->repository->detail($id,$this->request->merId());
if(!$data) return app('json')->fail('数据不存在');
return app('json')->success($data);
}
public function markForm($id)
{
return app('json')->success(formToData($this->repository->markForm($id)));
}
public function mark($id)
{
$ret = $this->repository->getWhere([$this->repository->getPk() => $id,'mer_id' => $this->request->merId()]);
if(!$ret) return app('json')->fail('数据不存在');
$data = $this->request->params(['mark']);
$this->repository->update($id,$data);
return app('json')->success('备注成功');
}
public function export()
{
$where = $this->request->params(['date','status','financial_type','financial_status','keyword']);
$where['keywords_'] = $where['keyword'];
unset($where['keyword']);
$where['mer_id'] = $this->request->merId();
[$page, $limit] = $this->getPage();
$data = app()->make(ExcelService::class)->financialLog($where,$page,$limit);
return app('json')->success($data);
}
}

View File

@ -0,0 +1,80 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\system\notice;
use app\common\repositories\system\notice\SystemNoticeLogRepository;
use crmeb\basic\BaseController;
use think\App;
/**
* Class SystemNotice
* @package app\controller\merchant\system\notice
* @author xaboy
* @day 2020/11/6
*/
class SystemNoticeLog extends BaseController
{
/**
* @var SystemNoticeLogRepository
*/
protected $repository;
/**
* SystemNoticeLog constructor.
* @param App $app
* @param SystemNoticeLogRepository $repository
*/
public function __construct(App $app, SystemNoticeLogRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
/**
* @return \think\response\Json
* @author xaboy
* @day 2020/11/6
*/
public function lst()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['is_read', 'date', 'keyword']);
$where['mer_id'] = $this->request->merId();
return app('json')->success($this->repository->getList($where, $page, $limit));
}
/**
* @param $id
* @author xaboy
* @day 2020/11/6
*/
public function read($id)
{
$this->repository->read(intval($id), $this->request->merId());
return app('json')->success();
}
public function del($id)
{
$this->repository->del(intval($id), $this->request->merId());
return app('json')->success();
}
public function unreadCount()
{
return app('json')->success(['count' => $this->repository->unreadCount($this->request->merId())]);
}
}

View File

@ -0,0 +1,101 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\system\openapi;
use app\common\repositories\openapi\OpenAuthRepository;
use app\validate\supply\OpenAuthValidate;
use crmeb\basic\BaseController;
use think\App;
class OpenApi extends BaseController
{
protected $repository;
public function __construct(App $app, OpenAuthRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
public function lst()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['title','access_key']);
$where['mer_id'] = $this->request->merId();
$data = $this->repository->getList($where, $page, $limit);
return app('json')->success($data);
}
public function createForm()
{
return app('json')->success(formToData($this->repository->form($this->request->merId())));
}
public function create()
{
$data = $this->checkParams();
$this->repository->create($this->request->merId(),$data);
return app('json')->success('添加成功');
}
public function updateForm($id)
{
return app('json')->success(formToData($this->repository->form($this->request->merId(),$id)));
}
public function update($id)
{
$data = $this->checkParams($id);
$data['update_time'] = date('Y-m-d H:i:s',time());
$this->repository->update($id,$data);
return app('json')->success('编辑成功');
}
public function switchWithStatus($id)
{
$status = $this->request->param('status',0) == 1 ?: 0;
$this->repository->update($id,['status' => $status]);
return app('json')->success('修改成功');
}
public function delete($id)
{
$this->repository->update($id,['is_del' => 1, 'delete_time' => date('Y-m-d H:i:s',time())]);
return app('json')->success('删除成功');
}
public function getSecretKey($id)
{
$data = $this->repository->getSecretKey($id);
return app('json')->success($data);
}
public function setSecretKey($id)
{
$data = $this->repository->setSecretKey($id, $this->request->merId());
return app('json')->success('重置成功',$data);
}
public function checkParams($id = 0)
{
$data = $this->request->params(['title','access_key','status','mark','auth','sort']);
$make = app()->make(OpenAuthValidate::class);
if ($id) {
unset($data['access_key']);
$make->scene('edit')->check($data);
} else {
$make->check($data);
}
return $data;
}
}

View File

@ -0,0 +1,89 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\system\serve;
use app\common\repositories\system\config\ConfigValueRepository;
use app\common\repositories\system\serve\ServeOrderRepository;
use crmeb\basic\BaseController;
use app\common\repositories\system\merchant\MerchantRepository;
use think\App;
use think\facade\Cache;
class Config extends BaseController
{
/**
* @var ServeOrderRepository
*/
protected $repository;
/**
* Merchant constructor.
* @param App $app
* @param ServeOrderRepository $repository
*/
public function __construct(App $app, ServeOrderRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
public function info()
{
$sms_info = systemConfigNoCache('serve_account');
$mer_id = $this->request->merId();
$ret = app()->make(MerchantRepository::class)->get($mer_id);
$data['mer_id'] = $ret['mer_id'];
$data = [
'info' =>$sms_info,
'copy_product_status' => systemConfig('copy_product_status'),
'copy_product_num' => $ret['copy_product_num'],
'crmeb_serve_dump' => systemConfig('crmeb_serve_dump'),
'export_dump_num' => $ret['export_dump_num'],
];
return app('json')->success($data);
}
public function getConfig()
{
$merId = $this->request->merId();
$config = [
'mer_from_com',
'mer_from_name',
'mer_from_tel',
'mer_from_addr',
'mer_config_siid',
'mer_config_temp_id'
];
$data = merchantConfig($merId,$config);
return app('json')->success($data);
}
public function setConfig()
{
$config = [
'mer_from_com',
'mer_from_name',
'mer_from_tel',
'mer_from_addr',
'mer_config_siid',
'mer_config_temp_id'
];
$data = $this->request->params($config);
app()->make(ConfigValueRepository::class)->setFormData($data,$this->request->merId());
return app('json')->success('保存成功');
}
}

View File

@ -0,0 +1,85 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply\system\serve;
use app\common\repositories\system\serve\ServeMealRepository;
use app\common\repositories\system\serve\ServeOrderRepository;
use crmeb\basic\BaseController;
use think\App;
use think\facade\Cache;
class Serve extends BaseController
{
/**
* @var ServeOrderRepository
*/
protected $repository;
/**
* Merchant constructor.
* @param App $app
* @param ServeOrderRepository $repository
*/
public function __construct(App $app, ServeOrderRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
public function getQrCode()
{
$sms_info = systemConfigNoCache('serve_account');
if (!$sms_info) {
return app('json')->fail('平台未登录一号通');
}
$data = $this->request->params(['meal_id','pay_type']);
$ret = $this->repository->QrCode($this->request->merId(),'meal', $data);
return app('json')->success($ret);
}
public function meal()
{
$sms_info = systemConfigNoCache('serve_account');
if (!$sms_info) {
return app('json')->fail('平台未登录一号通');
}
[$page, $limit] = $this->getPage();
$type = $this->request->param( 'type','copy');
if ($type == 'copy' && !systemConfig('copy_product_status')) {
return app('json')->fail('平台未开启一号通商品复制');
}
if ($type == 'dump' && systemConfig('crmeb_serve_dump') != 1) {
return app('json')->fail('平台未开启一号通电子面单');
}
$where['type'] = $type == 'copy' ? 1 : 2;
$where['status'] = 1;
$data = app()->make(ServeMealRepository::class)->getList($where, $page, $limit);
return app('json')->success($data);
}
public function lst()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['status', 'type']);
$where['mer_id'] = $this->request->merId();
$data = $this->repository->getList($where, $page, $limit);
return app('json')->success($data);
}
}

View File

@ -0,0 +1,97 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\controller\supply\user;
use app\common\repositories\user\LabelRuleRepository;
use app\common\repositories\user\UserLabelRepository;
use app\validate\supply\LabelRuleValidate;
use crmeb\basic\BaseController;
use think\App;
use think\exception\ValidateException;
class LabelRule extends BaseController
{
protected $repository;
public function __construct(App $app, LabelRuleRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
public function getList()
{
$where = $this->request->params(['keyword', 'type']);
$where['mer_id'] = $this->request->merId();
[$page, $limit] = $this->getPage();
return app('json')->success($this->repository->getList($where, $page, $limit));
}
public function create()
{
$data = $this->checkParams();
$data['mer_id'] = $this->request->merId();
if (app()->make(UserLabelRepository::class)->existsName($data['label_name'], $data['mer_id'], 1))
return app('json')->fail('标签名已存在');
$this->repository->create($data);
return app('json')->success('添加成功');
}
public function update($id)
{
$data = $this->checkParams();
$mer_id = $this->request->merId();
if (!$label = $this->repository->getWhere(['label_rule_id' => $id, 'mer_id' => $mer_id]))
return app('json')->fail('数据不存在');
if (app()->make(UserLabelRepository::class)->existsName($data['label_name'], $mer_id, 1, $label->label_id))
return app('json')->fail('标签名已存在');
$this->repository->update(intval($id), $data);
return app('json')->success('编辑成功');
}
public function delete($id)
{
if (!$this->repository->existsWhere(['label_rule_id' => $id, 'mer_id' => $this->request->merId()]))
return app('json')->fail('数据不存在');
$this->repository->delete(intval($id));
return app('json')->success('删除成功');
}
public function sync($id)
{
if (!$this->repository->existsWhere(['label_rule_id' => $id, 'mer_id' => $this->request->merId()]))
return app('json')->fail('数据不存在');
$this->repository->syncUserNum(intval($id));
return app('json')->success('更新成功');
}
/**
* @return array
* @author xaboy
* @day 2020/10/21
*/
public function checkParams()
{
$data = $this->request->params(['label_name', 'min', 'max', 'type', 'data']);
app()->make(LabelRuleValidate::class)->check($data);
if (!$data['type']) {
if (false === filter_var($data['min'], FILTER_VALIDATE_INT) || false === filter_var($data['max'], FILTER_VALIDATE_INT)) {
throw new ValidateException('数值必须为整数');
}
}
return $data;
}
}

View File

@ -0,0 +1,38 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\controller\supply\user;
use crmeb\basic\BaseController;
use app\common\repositories\user\UserRepository;
use think\App;
class User extends BaseController
{
protected $repository;
public function __construct(App $app, UserRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
public function getUserList()
{
$keyword = $this->request->param('keyword', '');
if (!$keyword)
return app('json')->fail('请输入关键字');
[$page, $limit] = $this->getPage();
return app('json')->success($this->repository->merList($keyword, $page, $limit));
}
}

View File

@ -0,0 +1,66 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\controller\supply\user;
use app\common\repositories\user\UserBillRepository;
use crmeb\basic\BaseController;
use think\App;
/**
* Class UserSupply
* @package app\controller\supply\user
* @author xaboy
* @day 2020/10/20
*/
class UserIntegral extends BaseController
{
protected $repository;
public function __construct(App $app, UserBillRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
/**
* TODO 积分日志
* @return \think\response\Json
* @author Qinii
* @day 6/9/21
*/
public function getList()
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['keyword', 'date']);
$where['category'] = 'mer_integral';
$where['mer_id'] = $this->request->merId();
return app('json')->success($this->repository->getList($where, $page, $limit));
}
/**
* TODO
* @return \think\response\Json
* @author Qinii
* @day 6/9/21
*/
public function getTitle()
{
return app('json')->success($this->repository->getStat($this->request->merId()));
}
}

View File

@ -0,0 +1,119 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\controller\supply\user;
use app\common\repositories\store\coupon\StoreCouponUserRepository;
use app\common\repositories\store\order\StoreOrderRepository;
use app\common\repositories\user\UserLabelRepository;
use app\common\repositories\user\UserSupplyRepository;
use crmeb\basic\BaseController;
use FormBuilder\Exception\FormBuilderException;
use think\App;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
/**
* Class UserSupply
* @package app\controller\supply\user
* @author xaboy
* @day 2020/10/20
*/
class UserMerchant extends BaseController
{
/**
* @var UserSupplyRepository
*/
protected $repository;
/**
* UserMerchant constructor.
* @param App $app
* @param UserSupplyRepository $repository
*/
public function __construct(App $app, UserSupplyRepository $repository)
{
parent::__construct($app);
$this->repository = $repository;
}
/**
* @return \think\response\Json
* @author xaboy
* @day 2020/10/20
*/
public function getList()
{
$where = $this->request->params(['nickname', 'sex', 'is_promoter', 'user_time_type', 'user_time', 'pay_count', 'label_id', 'user_type']);
[$page, $limit] = $this->getPage();
$where['mer_id'] = $this->request->merId();
return app('json')->success($this->repository->getList($where, $page, $limit));
}
/**
* @param $id
* @return mixed
* @throws DataNotFoundException
* @throws DbException
* @throws FormBuilderException
* @throws ModelNotFoundException
* @author xaboy
* @day 2020-05-08
*/
public function changeLabelForm($id)
{
if (!$this->repository->exists($id))
return app('json')->fail('数据不存在');
return app('json')->success(formToData($this->repository->changeLabelForm($this->request->merId(), $id)));
}
/**
* @param $id
* @param UserLabelRepository $labelRepository
* @return mixed
* @throws DbException
* @author xaboy
* @day 2020-05-08
*/
public function changeLabel($id, UserLabelRepository $labelRepository)
{
$label_id = (array)$this->request->param('label_id', []);
if (!$this->repository->exists($id))
return app('json')->fail('数据不存在');
$merId = $this->request->merId();
$label_id = $labelRepository->intersection((array)$label_id, $merId, 0);
$label_id = array_unique(array_merge($label_id, $this->repository->get($id)->authLabel));
$label_id = implode(',', $label_id);
$this->repository->update($id, compact('label_id'));
return app('json')->success('修改成功');
}
public function order($uid)
{
[$page, $limit] = $this->getPage();
$data = app()->make(StoreOrderRepository::class)->userMerList($uid, $this->request->merId(), $page, $limit);
return app('json')->success($data);
}
public function coupon($uid)
{
[$page, $limit] = $this->getPage();
$data = app()->make(StoreCouponUserRepository::class)->userList(['mer_id' => $this->request->merId(), 'uid' => (int)$uid], $page, $limit);
return app('json')->success($data);
}
}

View File

@ -0,0 +1,35 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply;
use think\Validate;
class BroadcastGoodsValidate extends Validate
{
protected $failException = true;
protected $rule = [
'name|商品名称' => 'require|min:3|max:14',
'cover_img|商品图' => 'require',
'price|价格' => 'require|min:0.01',
'product_id|商品' => 'require|array|length:2',
];
public function isBatch()
{
$this->rule['product_id|商品'] = 'require|integer';
return $this;
}
}

View File

@ -0,0 +1,52 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply;
use think\Validate;
class BroadcastRoomValidate extends Validate
{
protected $failException = true;
protected $rule = [
'name|直播间名字' => 'require|min:3|max:17',
'cover_img|背景图' => 'require',
'share_img|分享图' => 'require',
'anchor_name|主播昵称' => 'require|min:4|max:15',
'anchor_wechat|主播微信号' => 'require',
'phone|联系电话' => 'require|mobile',
'start_time|直播时间' => 'require|array|length:2|checkTime',
'type|直播间类型' => 'require|in:0,1',
'screen_type|显示样式' => 'require|in:0,1',
'close_like|是否开启点赞' => 'require|in:0,1',
'close_goods|是否开启货架' => 'require|in:0,1',
'close_comment|是否开启评论' => 'require|in:0,1',
'replay_status|是否开启回放' => 'require|in:0,1',
'close_share|是否开启分享' => 'require|in:0,1',
'close_kf|是否开启客服' => 'require|in:0,1',
];
protected function checkTime($value)
{
$start = strtotime($value[0]);
$end = strtotime($value[1]);
if ($end < $start) return '请选择正确的直播时间';
if ($start < strtotime('+ 15 minutes')) return '开播时间必须大于当前时间15分钟';
if ($start >= strtotime('+ 6 month')) return '开播时间不能在6个月后';
if (($end - $start) < (60 * 30)) return '直播时间不得小于30分钟';
if (($end - $start) > (60 * 60 * 24)) return '直播时间不得超过24小时';
return true;
}
}

View File

@ -0,0 +1,45 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply;
use think\Validate;
class DeliveryStationValidate extends Validate
{
protected $failException = true;
protected $rule = [
'station_name|门店名称' => 'require',
'business|支持配送的物品品类' => 'require|number',
'station_address|门店地址' => 'require',
'city_name|所属城市' => 'require',
'lng|门店经度' => 'require',
'lat|门店纬度' => 'require',
'contact_name|联系人姓名' => 'require',
'phone|联系人电话' => 'require|mobile',
];
public function sceneDada()
{
return $this->append('username','require|mobile')
->append('password','require');
}
public $message = [
'username.mobile' => '达达账号必须是手机号',
'username.require'=> '达达账号必须填写',
'password' => '达达密码必须填写',
];
}

View File

@ -0,0 +1,33 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply;
use think\Validate;
class LabelRuleValidate extends Validate
{
protected $failException = true;
protected $rule = [
'type|规则类型' => 'require|in:0,1',
'min|最小值' => 'require|float|>=:0',
'max|最大值' => 'require|float|>=:min',
'label_name|标签名' => 'require|length:2,10'
];
protected $message = [
'max.egt' => '最大值必须大于等于最小值',
];
}

View File

@ -0,0 +1,297 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply;
use think\Validate;
class MerchantApplymentsValidate extends Validate
{
protected $failException = true;
//2401小微商户指无营业执照的个人商家。
//2500个人卖家指无营业执照已持续从事电子商务经营活动满6个月且期间经营收入累计超过20万元的个人商家。若选择该主体请在“补充说明”填写相关描述
//4个体工商户营业执照上的主体类型一般为个体户、个体工商户、个体经营。
//2企业营业执照上的主体类型一般为有限公司、有限责任公司。
//3党政、机关及事业单位包括国内各级、各类政府机构、事业单位等公安、党 团、司法、交通、旅游、工商税务、市政、医疗、教育、学校等机构)。
//1708其他组织不属于企业、政府/事业单位的组织机构(如社会团体、民办非企业、基 金会),要求机构已办理组织机构代码证。
protected $rule = [
'organization_type|主体类型' => 'require|in:2,3,4,2401,2500,1708',
'business_license_info|营业执照/登记证书信息' => 'checkBusinessInfo',
// 'organization_cert_info|组织机构代码证信息' => 'checkOrganization',
'id_doc_type|证件类型' => 'require|in:1,2,3,4,5,6,7,8',
'id_card_info|经营者/法人身份证信息' => 'checkIdCardInfo',
'id_doc_info|经营者/法人身份证信息' => 'checkIdDocInfo',
// 'need_account_info|是否填写结算银行账户' => 'require|in:true,false', 废弃字段
'account_info|结算银行账户' => 'getAccountInfo',
'contact_info|超级管理员信息' => 'getContactInfo',
'sales_scene_info|店铺信息'=>'checkSalesSceneInfo',
'merchant_shortname|商户简称' => 'require',
'business_addition_desc' => 'checkBusinessAdditionDesc',
];
/**
* TODO 营业执照/登记证书信息
* @param $item
* @param $rule
* @param $data
* @return bool|string
* @author Qinii
* @day 6/22/21
*/
protected function checkBusinessInfo($item,$rule,$data)
{
if(!in_array($data['organization_type'],['2401','2500'])){
if(empty($item)) return '营业执照/登记证书信息为空';
if(!isset($item['business_license_copy']) || empty($item['business_license_copy'])) return '证件扫描件为空';
if(!isset($item['business_license_number']) || empty($item['business_license_number'])) return '证件注册号为空';
if(!isset($item['merchant_name']) || empty($item['merchant_name'])) return '商户名称为空';
if(!isset($item['legal_person']) || empty($item['legal_person'])) return '经营者/法定代表人姓名为空';
if(isset($item['business_time'])) {
$statr = $item['business_time'][0];
$end = $item['business_time'][1];
if ($end !== '长期') {
$statr = strtotime($statr);
$end = strtotime($end);
$t = $end - $statr;
if (($t / (3600 * 24)) <= 60) return '营业执照/登记证书有效期必须大于60天即结束时间距当前时间需超过60天';
}
}
}
return true;
}
/**
* TODO 组织机构代码证信息
* @param $item
* @param $rule
* @param $data
* @return bool|string
* @author Qinii
* @day 6/22/21
*/
protected function checkOrganization($item,$rule,$data)
{
$len = strlen($data['business_license_info']['business_license_number']);
if(!in_array($data['organization_type'],['4','2401','2500']) && $len === 18){
if(empty($item)) return '组织机构代码证信息为空';
if(!isset($item['organization_copy']) || empty($item['organization_copy'])) return '组织机构代码证照片为空';
if(!isset($item['organization_number']) || empty($item['organization_number'])) return '组织机构代码为空';
if(!isset($item['organization_time']) || empty($item['organization_time'])) return '组织机构代码有效期限为空';
// list($statr,$end) = explode(',',$item['organization_time']);
$statr = $item['organization_time'][0];
$end = $item['organization_time'][1];
if($end !== '长期') {
$statr = strtotime($statr);
$end = strtotime($end);
$t = $end - $statr;
if(($t/(3600 * 24)) <= 60) return '组织机构代码证有效期必须大于60天即结束时间距当前时间需超过60天';
}
}
return true;
}
/**
* TODO 经营者/法人身份证信息/身份证
* @param $item
* @param $rule
* @param $data
* @return bool|string
* @author Qinii
* @day 6/22/21
*/
protected function checkIdCardInfo($item,$rule,$data)
{
if($data['id_doc_type'] == 1){
if(empty($item)) return '经营者/法人身份证信息为空';
if(!isset($item['id_card_copy']) || empty($item['id_card_copy'])) return '身份证人像面照片为空';
if(!isset($item['id_card_national']) || empty($item['id_card_national'])) return '身份证国徽面照片为空';
if(!isset($item['id_card_name']) || empty($item['id_card_name'])) return '身份证姓名为空';
if(!isset($item['id_card_number']) || empty($item['id_card_number'])) return '身份证号码为空';
if(!isset($item['id_card_valid_time_begin']) || empty($item['id_card_valid_time_begin'])) return '经营者/法人身份证信息身份证开始时间为空';
if(!isset($item['id_card_valid_time']) || empty($item['id_card_valid_time'])) return '经营者/法人身份证信息身份证有效期限为空';
if($item['id_card_valid_time'] !== '长期') {
$statr = time();
$end = strtotime($item['id_card_valid_time']);
$t = $end - $statr;
if(($t/(3600 * 24)) <= 60) return '经营者/法人身份证信息证件结束日期必须大于60天即结束时间距当前时间需超过60天';
if(strtotime($item['id_card_valid_time_begin']) >= strtotime($item['id_card_valid_time'])) return '经营者/法人身份证信息证件结束日期必须大于证件开始时间';
}
if($data['organization_type'] === 2){
if(!isset($item['id_card_address']) || empty($item['id_card_address'])) return '经营者/法人身份证信息身份证居住地址为空';
}
};
return true;
}
/**
* TODO 经营者/法人身份证信息/通行证
* @param $item
* @param $rule
* @param $data
* @return bool|string
* @author Qinii
* @day 6/22/21
*/
protected function checkIdDocInfo($item,$rule,$data)
{
if(in_array($data['organization_type'],['2401','2500']) && !empty($item)) return '小微/个人卖家可选证件类型:身份证';
if($data['id_doc_type'] !== 1){
if(empty($item)) return '经营者/法人身份证信息为空';
if(!isset($item['id_doc_name']) || empty($item['id_doc_name'])) return '证件姓名为空';
if(!isset($item['id_doc_number']) || empty($item['id_doc_number'])) return '证件号码为空';
if(!isset($item['id_doc_copy']) || empty($item['id_doc_copy'])) return '经营者/法人其他类型证件信息证件正面照片为空';
if($data['id_doc_type'] !== 2) //护照不需要传反面
{
if(!isset($item['id_doc_copy_back']) || empty($item['id_doc_copy_back'])) return '经营者/法人其他类型证件信息证件反面照片为空';
}
if(!isset($item['doc_period_begin']) || empty($item['doc_period_begin'])) return '经营者/法人其他类型证件信息证件有效期开始时间为空';
if(!isset($item['doc_period_end']) || empty($item['doc_period_end'])) return '经营者/法人其他类型证件信息证件结束日期为空';
if($item['doc_period_end'] !== '长期') {
$statr = time();
$end = strtotime($item['doc_period_end']);
$t = $end - $statr;
if(($t/(3600 * 24)) <= 60) return '经营者/法人其他类型证件信息证件结束日期必须大于60天即结束时间距当前时间需超过60天';
if(strtotime($item['doc_period_begin']) >= strtotime($item['doc_period_end'])) return '经营者/法人其他类型证件信息证件结束日期必须大于证件开始时间';
if($data['organization_type'] === 2){
if(!isset($item['id_doc_address']) || empty($item['id_doc_address'])) return '经营者/法人其他类型证件信息证件居住地址为空';
}
}
}
return true;
}
/**
* TODO 结算银行账户
* @param $item
* @param $rule
* @param $data
* @return bool|string
* @author Qinii
* @day 6/22/21
*/
protected function getAccountInfo($item,$rule,$data)
{
// if($data['need_account_info']){
if(empty($item)) return '结算银行账户信息为空';
if(!isset($item['bank_account_type']) || empty($item['bank_account_type'])) return '账户类型为空';
if(!isset($item['account_bank']) || empty($item['account_bank'])) return '开户银行为空';
if(!isset($item['account_name']) || empty($item['account_name'])) return '开户名称为空';
if(!isset($item['bank_address_code']) || empty($item['bank_address_code'])) return '开户银行省市编码为空';
if(!isset($item['account_number']) || empty($item['account_number'])) return '银行帐号为空';
// }
return true;
}
/**
* TODO 超级管理员信息
* @param $item
* @param $rule
* @param $data
* @return bool|string
* @author Qinii
* @day 6/22/21
*/
protected function getContactInfo($item,$rule,$data)
{
if(empty($item)) return '超级管理员信息信息为空';
if(!isset($item['contact_type']) || empty($item['contact_type'])) return '超级管理员类型为空';
if(!isset($item['contact_name']) || empty($item['contact_name'])) return '超级管理员姓名为空';
if(!isset($item['contact_id_card_number']) || empty($item['contact_id_card_number'])) return '超级管理员身份证件号码为空';
if(!isset($item['mobile_phone']) || empty($item['mobile_phone'])) return '超级管理员手机为空';
if(!in_array($data['organization_type'],['2401','2500'])){
if(!isset($item['contact_email']) || empty($item['contact_email'])) return '邮箱为空';
}
if($item['contact_type'] === 66) //当超级管理员类型为66经办人时
{
if(!isset($item['contact_id_doc_type']) || empty($item['contact_id_doc_type']) || !in_array($item['contact_id_doc_type'],[1,2,3,4,5,6,7,8])) return '超级管理员证件类型为空或不合法';
if(!isset($item['contact_id_doc_copy']) || empty($item['contact_id_doc_copy'])) return '超级管理员信息证件正面照片为空';
if($item['contact_id_doc_type'] !== 2) //护照不需要传反面
{
if(!isset($item['contact_id_doc_copy_back']) || empty($item['contact_id_doc_copy_back'])) return '超级管理员信息证件反面照片为空';
}
if(!isset($item['contact_id_doc_period_begin']) || empty($item['contact_id_doc_period_begin'])) return '超级管理员信息证件有效期开始时间为空';
if(!isset($item['contact_id_doc_period_end']) || empty($item['contact_id_doc_period_end'])) return '超级管理员信息证件结束日期为空';
if($item['contact_id_doc_period_end'] !== '长期') {
$statr = time();
$end = strtotime($item['contact_id_doc_period_end']);
$t = $end - $statr;
if(($t/(3600 * 24)) <= 60) return '超级管理员信息证件结束日期必须大于60天即结束时间距当前时间需超过60天';
if(strtotime($item['contact_id_doc_period_begin']) >= strtotime($item['contact_id_doc_period_end'])) return '超级管理员信息证件结束日期必须大于证件开始时间';
}
if(!isset($item['business_authorization_letter']) || empty($item['business_authorization_letter'])) return '超级管理员信息业务办理授权函为空';
}
return true;
}
/**
* TODO 店铺信息
* @param $item
* @param $rule
* @param $data
* @return bool|string
* @author Qinii
* @day 6/22/21
*/
protected function checkSalesSceneInfo($item,$rule,$data)
{
if(empty($item)) return '店铺信息为空';
if(!isset($item['store_name']) || empty($item['store_name'])) return '店铺名称为空';
if(!isset($item['store_url']) && !isset($item['store_url'])) return '店铺链接和店铺二维码二选一';
return true;
}
/**
* TODO 补充说明s
* @param $item
* @param $rule
* @param $data
* @return bool|string
* @author Qinii
* @day 6/24/21
*/
protected function checkBusinessAdditionDesc($item,$rule,$data)
{
if($data['organization_type'] == 2500 && empty($item)) return '若主体为“个人卖家”:补充说明不能为空';
return true;
}
}

View File

@ -0,0 +1,50 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply;
use think\Validate;
class MerchantFinancialAccountValidate extends Validate
{
protected $failException = true;
/*
{
"financial_type":2,
"name":"王二小",
"idcard":"",
"wechat":"1",
"wechat_code":"456461516"
}
{
"financial_type":3,
"name":"王二小",
"idcard":"",
"alipay":"1",
"alipay_code":"456461516"
}
*/
protected $rule = [
'financial_type|转账类型' => 'require|in:1,2,3',
'name|姓名' => 'require|chs',
'bank|开户银行' => 'requireIf:financial_type,1',
'bank_code|银行卡号' => 'requireIf:financial_type,1',
//'idcard|身份证号' => 'requireIf:financial_type,2,3|idCard',
'wechat|微信号' => 'requireIf:financial_type,2',
'wechat_code|微信收款二维码' => 'requireIf:financial_type,2',
'alipay|支付宝账号' => 'requireIf:financial_type,3',
'alipay_code|收款二维码' => 'requireIf:financial_type,3',
];
}

View File

@ -0,0 +1,31 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply;
use think\Validate;
class MerchantTakeValidate extends Validate
{
protected $failException = true;
protected $rule = [
'mer_take_name|自提点名称' => 'require',
'mer_take_phone|自提点手机号' => 'require|mobile',
'mer_take_address|自提点地址' => 'require',
'mer_take_location|店铺经纬度' => 'require|array|length:2',
'mer_take_day|自提点营业日期' => 'array|max:7',
'mer_take_time|自提点营业时间' => 'array|length:2',
];
}

View File

@ -0,0 +1,41 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply;
use think\Validate;
class MerchantUpdateValidate extends Validate
{
protected $failException = true;
protected $rule = [
'mer_info|店铺简介' => 'require|max:200',
'mer_avatar|店铺头像' => 'require|max:128',
'mer_banner|店铺banner' => 'require|max:128',
'mini_banner|店铺街banner' => 'max:128',
'mer_keyword|店铺关键字' => 'max:128',
'mer_address|店铺地址' => 'require|max:128',
'long|店铺经度' => 'max:24',
'lat|店铺纬度' => 'max:24',
'services_type|联系客服方式' => 'require|in:0,1',
];
protected function isPhone($val)
{
$res = preg_match('/^((\+86|\+86\-)|(86|86\-)|(0086|0086\-))?1\d{10}$|^(0\d{2,3}\-)?([2-9]\d{6,7})+(\-\d{1,6})?$/', $val);
if ($res) return true;
return '服务电话格式有误';
}
}

View File

@ -0,0 +1,39 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply;
use think\Validate;
class OpenAuthValidate extends Validate
{
protected $failException = true;
protected $rule = [
'title|标题' => 'require',
'access_key|accessKey' => 'require|unique:open_auth,access_key',
'auth|权限' => 'require|checkAuth',
];
public function checkAuth()
{
return true;
}
public function sceneEdit()
{
return $this->only(['title','auth']);
}
}

View File

@ -0,0 +1,42 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply;
use think\Validate;
/**
* Class WechatReplyValidate
* @package app\validate\admin
* @author xaboy
* @day 2020-04-27
*/
class ServiceReplyValidate extends Validate
{
/**
* @var bool
*/
protected $failException = true;
/**
* @var array
*/
protected $rule = [
'type|类型' => 'require|in:1,2',
'keyword|关键字' => 'require|max:32',
'content|回复内容' => 'require',
'status|开启状态' => 'require|in:0,1'
];
}

View File

@ -0,0 +1,70 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply;
use think\Validate;
class ShippingTemplateValidate extends Validate
{
protected $failException = true;
protected $rule = [
'name|名称' => 'require|max:32',
'type|计费方式' => 'require|in:0,1,2',
'appoint|指定包邮状态' => 'require|in:0,1',
'region|配送区域信息' => 'Array|require|min:1|region',
'undelivery|区域不配送状态' => 'require|in:0,1,2',
'free|包邮信息' => 'requireIf:appoint,1|Array|free',
'undelives|不配送区域信息'=>'requireIf:undelivery,1|Array|undelive',
];
protected function region($value,$rule,$data)
{
foreach ($value as $k => $v){
if ($k != 0 && empty($v['city_id']))
return '配送城市信息不能为空';
if (!is_numeric($v['first']) || $v['first'] < 0)
return '首件条件不能小0';
if (!is_numeric($v['first_price']) || $v['first_price'] < 0)
return '首件金额不能小于0';
if (!is_numeric($v['continue']) || ($v['continue'] < 0))
return '续件必须为不小于零的整数';
if (!is_numeric($v['continue_price']) || $v['continue_price'] < 0 )
return '追加金额为不小于零的数';
}
return true;
}
protected function free($value,$rule,$data)
{
if(!$data['appoint']) return true;
foreach ($value as $v){
if (empty($v['city_id']))
return '包邮城市信息不能为空';
if (!is_int($v['number']) || $v['number'] < 0)
return '包邮条件为不小于零的整数';
if (!is_numeric($v['price']) ||$v['price'] < 0)
return '包邮金额必须为不小于零的数字';
}
return true;
}
protected function undelive($value,$rule,$data)
{
if($data['undelivery'] == 1){
if (empty($value['city_id']))
return '不配送城市信息不能为空';
}
return true;
}
}

View File

@ -0,0 +1,27 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply;
use think\Validate;
class StoreAttrTemplateValidate extends Validate
{
protected $failException = true;
protected $rule = [
'template_name|模板名称' => 'require|max:32',
'template_value|规则' => 'require|array|min:1'
];
}

View File

@ -0,0 +1,29 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply;
use think\Validate;
class StoreCouponSendValidate extends Validate
{
protected $failException = true;
protected $rule = [
'coupon_id|优惠券' => 'require|integer',
'mark|用户类型' => 'array',
'is_all|用户类型' => 'require|in:0,1',
'search|用户类型' => 'require|array',
'uid|用户' => 'array'
];
}

View File

@ -0,0 +1,49 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply;
use think\Validate;
class StoreCouponValidate extends Validate
{
protected $failException = true;
protected $rule = [
'title|优惠券名称' => 'require|max:32',
'coupon_price|优惠券面值' => 'require|float|>:0|dime',
'use_min_price|最低消费金额' => 'require|float',
'coupon_type|有效期类型' => 'require|in:0,1',
'coupon_time|有效期限' => 'requireIf:coupon_type,0|integer|>:0',
'use_start_time|有效期限' => 'requireIf:coupon_type,1|array|>:2',
'sort|排序' => 'require|integer',
'status|状态' => 'require|in:0,1',
'type|优惠券类型' => 'require|in:0,1,2,10,11,12,13',
'product_id|商品' => 'requireIf:type,1|array|>:0',
'send_type|类型' => 'require|in:0,1,2,3,4,5',
'full_reduction|满赠金额' => 'requireIf:send_type,1|float|>=:0',
'is_limited|是否限量' => 'require|in:0,1',
'is_timeout|是否限时' => 'require|in:0,1',
'range_date|领取时间' => 'requireIf:is_timeout,1|array|length:2',
'total_count|发布数量' => 'requireIf:is_limited,1|integer|>:0',
];
protected function dime($value)
{
if (!bcadd($value, 0, 1) == $value)
return '优惠券面值最多1位小数';
return true;
}
}

View File

@ -0,0 +1,35 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply;
use think\Exception;
use think\File;
use think\Validate;
class StoreDiscountsValidate extends Validate
{
protected $failException = true;
protected $rule = [
//"image|套餐图片" => 'require|max:128',
"title|套餐标题" => 'require|max:128',
"type|套餐类型" => 'require|in:0,1',
"is_limit|是否限够" => 'require',
"limit_num|限购数量" => 'require|max:4',
"is_time|是否限时" => "in:0,1",
"sort|排序" => "require",
"free_shipping|是否包邮" => "require",
'status|发货方式' => 'require',
'products|发货方式' => 'require',
];
}

View File

@ -0,0 +1,29 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply;
use think\Validate;
class StoreProductAdminValidate extends Validate
{
protected $failException = true;
protected $rule = [
"store_name|商品名称" => 'require',
"is_hot|是否热卖" => "in:0,1",
"is_best|是否精品" => "in:0,1",
"ficti|已售数量" => "number",
"status|审核状态" => "in:0,1,-1",
"refusal|拒绝理由" => "requireIf:status,-1"
];
}

View File

@ -0,0 +1,49 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply;
use think\Validate;
class StoreProductAssistValidate extends Validate
{
protected $failException = true;
protected $rule = [
"image|主图" => 'require|max:128',
"slider_image|轮播图" => 'require',
"store_name|商品名称" => 'require|max:128',
"store_info|商品简介" => 'require|max:128',
"product_id|原商品ID" => 'require',
"temp_id|运费模板" => 'require',
"start_time|开始时间" => 'require|checkTime',
"end_time|结束时间" => "require",
"assist_user_count|单人助力次数" => "require",
"assist_count|需助力总人数" => "require",
"attrValue|商品属性" => "require|Array"
];
public function isUpdate()
{
$this->rule['start_time|开始时间'] = 'require';
return $this;
}
protected function checkTime($value,$rule,$data)
{
$start_time = strtotime($data['start_time']);
$end_time = strtotime($data['end_time']);
if($start_time > $end_time) return '活动开始时间必须小于结束时间';
if($start_time < time()) return '活动开始时间必须大于当前时间';
return true;
}
}

View File

@ -0,0 +1,44 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply;
use think\Validate;
class StoreProductGroupValidate extends Validate
{
protected $failException = true;
protected $rule = [
"image|主图" => 'require|max:128',
"slider_image|轮播图" => 'require',
"store_name|商品名称" => 'require|max:128',
"store_info|商品简介" => 'require',
"product_id|原商品ID" => 'require',
"temp_id|运费模板" => 'require',
"start_time|开始时间" => 'require',
"end_time|结束时间" => "require",
"buying_count_num|开团总人数" => "require|>=:buying_num",
"attrValue|商品属性" => "require|Array|checkAttrValue",
"time|开团时长" => "require"
];
protected function checkAttrValue($value,$rule,$data)
{
foreach ($value as $v){
if($v['stock'] > $v['old_stock']){
return '限量不可大于库存';
}
}
return true;
}
}

View File

@ -0,0 +1,52 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply;
use think\Validate;
class StoreProductPresellValidate extends Validate
{
protected $failException = true;
protected $rule = [
"image|主图" => 'require|max:128',
"slider_image|轮播图" => 'require',
"store_name|商品名称" => 'require|max:128',
"store_info|商品简介" => 'require|max:128',
"product_id|原商品ID" => 'require',
"temp_id|运费模板" => 'require',
"start_time|开始时间" => 'require|checkTime',
"end_time|结束时间" => "require",
"presell_type|预售类型" => "require",
"final_start_time|尾款支付开始时间" => "requireIf:presell_type,2",
"final_end_time|尾款支付结束时间" => "requireIf:presell_type,2",
"delivery_type|发货类型" => "require",
"delivery_day|发货等待天数" => "require",
"attrValue|商品属性" => "require|Array"
];
protected function checkTime($value,$rule,$data)
{
$start_time = strtotime($data['start_time']);
$end_time = strtotime($data['end_time']);
if($start_time > $end_time) return '活动开始时间必须小于结束时间';
if($start_time < time()) return '活动开始时间必须大于当前时间';
if($data['presell_type'] == 2){
$final_start_time = strtotime($data['final_start_time']);
$final_end_time = strtotime($data['final_end_time']);
if($end_time > $final_start_time) return '尾款支付开始时间必须大于定金结束时间';
if($final_end_time < $final_start_time) return '尾款支付开始时间必须小于结束时间';
}
return true;
}
}

View File

@ -0,0 +1,86 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply;
use think\Exception;
use think\File;
use think\Validate;
class StoreProductValidate extends Validate
{
protected $failException = true;
protected $rule = [
"image|主图" => 'require|max:128',
"store_name|商品名称" => 'require|max:128',
"cate_id|平台分类" => 'require',
"mer_cate_id|商户分类" => 'array',
"unit_name|单位名" => 'require|max:4',
"spec_type" => "in:0,1",
"is_show是否上架" => "in:0,1",
"extension_type|分销类型" => "in:0,1",
"attr|商品规格" => "requireIf:spec_type,1|Array|checkUnique",
"attrValue|商品属性" => "require|array|productAttrValue",
'type|商品类型' => 'require|in:0,1,2',
'delivery_way|发货方式' => 'requireIf:is_ficti,0|require',
'once_min_count|最小限购' => 'min:0',
'pay_limit|是否限购' => 'require|in:0,1,2|payLimit',
];
protected function payLimit($value,$rule,$data)
{
if ($value && ($data['once_max_count'] < $data['once_min_count']))
return '限购数量不能小于最少购买件数';
return true;
}
protected function productAttrValue($value,$rule,$data)
{
$arr = [];
try{
foreach ($value as $v){
$sku = '';
if(isset($v['detail']) && is_array($v['detail'])){
sort($v['detail'],SORT_STRING);
$sku = implode(',',$v['detail']);
}
if(in_array($sku,$arr)) return '商品SKU重复';
$arr[] = $sku;
if(isset($data['extension_type']) && $data['extension_type'] && systemConfig('extension_status')){
if(!isset($v['extension_one']) || !isset($v['extension_two'])) return '佣金金额必须填写';
if(($v['extension_one'] < 0) || ($v['extension_two'] < 0))
return '佣金金额不可存在负数';
if($v['price'] < bcadd($v['extension_one'],$v['extension_two'],2))
return '自定义佣金总金额不能大于商品售价';
}
if ($data['product_type'] == 20 && !$v['ot_price']) {
return '积分商品兑换积分必须大于0';
}
}
} catch (\Exception $exception) {
return '商品属性格式错误';
}
return true;
}
protected function checkUnique($value)
{
$arr = [];
foreach ($value as $item){
if(in_array($item['value'],$arr)) return '规格重复';
$arr[] = $item['value'];
if (count($item['detail']) != count(array_unique($item['detail']))) return '属性重复';
}
return true;
}
}

View File

@ -0,0 +1,70 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply;
use think\File;
use think\Validate;
class StoreSeckillProductValidate extends Validate
{
protected $failException = true;
protected $rule = [
"image|主图" => 'require|max:128',
"slider_image|轮播图" => 'require',
"store_name|商品名称" => 'require|max:128',
"brand_id|品牌ID" => 'require',
"cate_id|平台分类" => 'require',
"mer_cate_id|商户分类" => 'array',
"unit_name|单位名" => 'require|max:4',
"spec_type" => "in:0,1",
"is_show|是否上架" => "in:0,1",
"start_day|开始日期" => "require",
"end_day|结束日期" => "require",
"start_time|开始时间" => "require",
"end_time|结束时间" => "require",
"old_product_id|原商品ID" => 'require',
"once_pay_count|单场限购" => 'require',
"all_pay_count|限购总数" => 'require',
"attr|商品规格" => "requireIf:spec_type,1|Array|checkUnique",
"attrValue|商品属性" => "Array|productAttrValue"
];
protected function productAttrValue($value,$rule,$data)
{
$arr = [];
foreach ($value as $v){
if ($v['stock'] > $v['old_stock']) return '限量不能大于库存';
$sku = '';
if(isset($v['detail']) && is_array($v['detail'])){
sort($v['detail'],SORT_STRING);
$sku = implode(',',$v['detail']);
}
if($v['stock'] < 1) return '限量不能小于1';
if(in_array($sku,$arr)) return '商品SKU重复';
$arr[] = $sku;
}
return true;
}
public function checkUnique($value)
{
$arr = [];
foreach ($value as $item){
if(in_array($item['value'],$arr)) return '规格重复';
$arr[] = $item['value'];
if (count($item['detail']) != count(array_unique($item['detail']))) return '属性重复';
}
return true;
}
}

View File

@ -0,0 +1,52 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\supply;
use think\Validate;
class StoreServiceValidate extends Validate
{
protected $failException = true;
protected $rule = [
'uid|客服' => 'require|array',
'uid.id|客服' => 'require|integer',
'nickname|客服名称' => 'require|max:12',
'avatar|客服头像' => 'max:250',
'account|客服账号' => 'require|min:5|max:16',
'pwd|客服密码' => 'require|min:6|max:16',
'confirm_pwd|确认密码' => 'require|min:6|max:16',
'is_open|状态' => 'require|in:0,1',
'status|状态' => 'require|in:0,1',
'is_verify|核销状态' => 'require|in:0,1',
'is_goods|商品管理状态' => 'require|in:0,1',
'notify|订单通知状态' => 'require|in:0,1',
'sort|排序' => 'require|integer',
'customer|展示统计管理状态' => 'require|in:0,1',
];
protected $message = [
'account.min' => '客服账号长度不能小于5个字符',
'uid.require' => '请选择一个用户绑定为客服',
'uid.id.require' => '用户ID不能为空'
];
public function update()
{
$this->rule['pwd|客服密码'] = 'min:6|max:16';
$this->rule['confirm_pwd|确认密码'] = 'min:6|max:16';
return $this;
}
}

243
route/supply/accounts.php Normal file
View File

@ -0,0 +1,243 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
use app\common\middleware\AllowOriginMiddleware;
use app\common\middleware\LogMiddleware;
use app\common\middleware\MerchantAuthMiddleware;
use app\common\middleware\MerchantTokenMiddleware;
use think\facade\Route;
use app\common\middleware\MerchantCheckBaseInfoMiddleware;
Route::group(function () {
Route::group('financial', function () {
Route::post('refund/margin', 'Financial/refundMargin')->name('supplytFinancialRefundMargin')->option([
'_alias' => '退保证金检测',
]);
Route::post('refund/margin_apply', 'Financial/refundMarginApply')->name('supplyFinancialRefundMarginApply')->option([
'_alias' => '退保证金申请',
]);
})->prefix('supply.system.financial.')->option([
'_path' => '/systemForm/modifyStoreInfo',
'_auth' => true,
]);
Route::group('financial', function () {
Route::get('account/form', '/accountForm')->name('supplyFinancialAccountForm')->option([
'_alias' => '收款方式表单',
'_auth' => false,
'_form' => 'supplyFinancialAccountSave',
]);
Route::post('account', '/accountSave')->name('supplyFinancialAccountSave')->option([
'_alias' => '收款方式',
]);
})->prefix('supply.system.financial.Financial')->option([
'_path' => '/accounts/payType',
'_auth' => true,
]);
//转账记录
Route::group('financial', function () {
Route::get('lst', 'Financial/lst')->name('supplyFinancialLst')->option([
'_alias' => '转账记录',
]);
Route::get('detail/:id', 'Financial/detail')->name('supplyFinancialDetail')->option([
'_alias' => '详情',
]);
Route::get('create/form', 'Financial/createForm')->name('supplyFinancialCreateForm')->option([
'_alias' => '申请表单',
'_auth' => false,
'_form' => 'supplyFinancialCreateSave',
]);
Route::post('create', 'Financial/createSave')->name('supplyFinancialCreateSave')->option([
'_alias' => '申请',
]);
Route::delete('delete/:id', 'Financial/delete')->name('supplyFinancialDelete')->option([
'_alias' => '删除',
]);
Route::get('mark/:id/form', 'Financial/markForm')->name('supplyFinancialMarkForm')->option([
'_alias' => '备注表单',
'_auth' => false,
'_form' => 'supplyFinancialMark',
]);
Route::post('mark/:id', 'Financial/mark')->name('supplyFinancialMark')->option([
'_alias' => '备注',
]);
Route::get('export', 'Financial/export')->name('supplyFinancialExport')->option([
'_alias' => '导出',
]);
Route::post('refund/margin', 'Financial/refundMargin')->name('supplyFinancialRefundMargin')->option([
'_alias' => '列表',
]);
})->prefix('supply.system.financial.')->option([
'_path' => '/accounts/transManagement',
'_auth' => true,
]);
//资金流水
Route::group('financial_record', function () {
//资金流水
Route::get('list', '/lst')->name('supplyFinancialRecordList')->option([
'_alias' => '列表',
]);
Route::get('export', '/export')->name('supplyFinancialRecordExport')->option([
'_alias' => '导出',
]);
Route::get('count', '/title')->name('supplyFinancialCount')->option([
'_alias' => '统计',
]);
})->prefix('admin.system.supply.FinancialRecord')->option([
'_auth' => true,
'_path' => '/accounts/capitalFlow',
'_append'=> [
[
'_name' =>'supplyStoreExcelLst',
'_path' =>'/accounts/capitalFlow',
'_alias' => '导出列表',
'_auth' => true,
],
[
'_name' =>'supplyStoreExcelDownload',
'_path' =>'/accounts/capitalFlow',
'_alias' => '导出下载',
'_auth' => true,
],
]
]);
//账单管理
Route::group('financial_record', function () {
//账单管理
Route::get('lst', '/getList')->name('supplyFinanciaRecordlLst')->option([
'_alias' => '列表',
]);
Route::get('title', '/getTitle')->name('supplyFinancialTitle')->option([
'_alias' => '统计',
]);
Route::get('detail/:type', '/detail')->name('supplyFinancialRecordDetail')->option([
'_alias' => '详情',
]);
Route::get('detail_export/:type', '/exportDetail')->name('supplyFinancialRecordDetailExport')->option([
'_alias' => '导出',
]);
})->prefix('admin.system.supply.FinancialRecord')->option([
'_auth' => true,
'_path' => '/accounts/statement',
'_append'=> [
[
'_name' =>'supplyStoreExcelLst',
'_path' =>'/accounts/statement',
'_alias' => '导出列表',
'_auth' => true,
],
[
'_name' =>'supplyStoreExcelDownload',
'_path' =>'/accounts/statement',
'_alias' => '导出下载',
'_auth' => true,
],
]
]);
//发票
Route::group('store/receipt', function () {
Route::get('lst', '/lst')->name('supplyOrderReceiptLst')->option([
'_alias' => '列表',
]);
Route::get('detail/:id', '/detail')->name('supplyOrderReceiptDetail')->option([
'_alias' => '详情',
]);
Route::get('set_recipt', '/setRecipt')->name('supplyOrderReceiptSetRecipt')->option([
'_alias' => '开发票',
]);
Route::post('save_recipt', '/saveRecipt')->name('supplyOrderReceiptSave')->option([
'_alias' => '保存发票',
]);
Route::get('mark/:id/form', '/markForm')->name('supplyOrderReceiptMarkForm')->option([
'_alias' => '备注表单',
'_auth' => false,
'_form' => 'supplyOrderReceiptMark',
]);
Route::post('mark/:id', '/mark')->name('supplyOrderReceiptMark')->option([
'_alias' => '备注',
]);
Route::post('update/:id', '/update')->name('supplyOrderReceiptUpdate')->option([
'_alias' => '编辑',
]);
})->prefix('supply.store.order.OrderReceipt')->option([
'_path' => '/order/invoice',
'_auth' => true,
]);
//分账单
Route::group('profitsharing', function () {
Route::get('lst', '/getList')->name('supplyOrderProfitsharingLst')->option([
'_alias' => '列表',
]);
Route::get('export', '/export')->name('supplyOrderProfitsharingExport')->option([
'_alias' => '导出',
]);
})->prefix('admin.order.OrderProfitsharing')->option([
'_path' => '/systemForm/applyList',
'_auth' => true,
'_append'=> [
[
'_name' =>'supplyStoreExcelLst',
'_path' =>'/systemForm/applyList',
'_alias' => '导出列表',
'_auth' => true,
],
[
'_name' =>'supplyStoreExcelDownload',
'_path' =>'/systemForm/applyList',
'_alias' => '导出下载',
'_auth' => true,
],
]
]);
//申请分账商户
Route::group('applyments',function(){
Route::post('create','/create')->name('supplyApplymentsCreate')->option([
'_alias' => '申请',
]);
Route::get('detail','/detail')->name('supplyApplymentsDetail')->option([
'_alias' => '详情',
]);
Route::post('update/:id','/update')->name('supplyApplymentsUpdate')->option([
'_alias' => '编辑',
]);
Route::post('upload/:field','/uploadImage')->name('supplyApplymentsUpload')->option([
'_alias' => '上传图片',
]);
Route::get('check','/check')->name('supplyApplymentsCheck')->option([
'_alias' => '查询审核结果',
'_auth' => false,
]);
})->prefix('supply.system.SupplyApplyments')->option([
'_path' => '/systemForm/applyments',
'_auth' => true,
]);
})->middleware(AllowOriginMiddleware::class)
->middleware(MerchantTokenMiddleware::class, true)
->middleware(MerchantAuthMiddleware::class)
->middleware(MerchantCheckBaseInfoMiddleware::class)
->middleware(LogMiddleware::class);

View File

@ -0,0 +1,96 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
use app\common\middleware\AllowOriginMiddleware;
use app\common\middleware\LogMiddleware;
use app\common\middleware\MerchantAuthMiddleware;
use app\common\middleware\MerchantTokenMiddleware;
use think\facade\Route;
use app\common\middleware\MerchantCheckBaseInfoMiddleware;
Route::group(function () {
//附件管理
Route::group('system/attachment', function () {
Route::get('scan_upload/qrcode/:pid', '/scanUploadQrcode')->name('supplyAttachmentScanQrcode')->option([
'_alias' => '上传二维码',
]);
Route::get('scan_upload/image/:token', '/scanUploadImage')->name('supplyAttachmentScanImage')->option([
'_alias' => '扫码上传图片',
]);
Route::post('scan_upload/image/:token', '/scanUploadSave')->name('supplyAttachmentScanImageSave')->option([
'_alias' => '扫码上传保存',
]);
Route::post('online_upload', '/onlineUpload')->name('supplyAttachmentOnline')->option([
'_alias' => '在线图片',
]);
Route::get('lst', '/getList')->name('supplyAttachmentLst')->option([
'_alias' => '列表',
]);
Route::delete('delete', '/delete')->name('supplyAttachmentDelete')->option([
'_alias' => '删除',
]);
Route::post('category', '/batchChangeCategory')->name('supplyAttachmentBatchChangeCategory')->option([
'_alias' => '批量修改',
]);
Route::get('update/:id/form', '/updateForm')->name('supplyAttachmentUpdateForm')->option([
'_alias' => '编辑表单的',
'_auth' => false,
'_form' => 'supplyAttachmentUpdate',
]);
Route::post('update/:id', '/update')->name('supplyAttachmentUpdate')->option([
'_alias' => '编辑',
]);
})->prefix('admin.system.attachment.Attachment')->option([
'_path' => '/config/picture',
'_auth' => true,
]);
//上传图片
Route::post('upload/image/:id/:field', 'admin.system.attachment.Attachment/image')->name('supplyUploadImage')->option([
'_path' => 'attachment',
'_alias' => '上传图片',
]);
//附件分类管理
Route::group('system/attachment/category', function () {
Route::get('formatLst', '/getFormatList')->name('supplyAttachmentCategoryGetFormatList')->option([
'_alias' => '列表',
]);
Route::get('create/form', '/createForm')->name('supplyAttachmentCategoryCreateForm')->option([
'_alias' => '添加表单',
'_auth' => false,
'_form' => 'supplyAttachmentCategoryCreate',
]);
Route::get('update/form/:id', '/updateForm')->name('supplyAttachmentCategoryUpdateForm')->option([
'_alias' => '编辑表单',
'_auth' => false,
'_form' => 'supplyAttachmentCategoryUpdate',
]);
Route::post('create', '/create')->name('supplyAttachmentCategoryCreate')->option([
'_alias' => '添加',
]);
Route::post('update/:id', '/update')->name('supplyAttachmentCategoryUpdate')->option([
'_alias' => '编辑',
]);
Route::delete('delete/:id', '/delete')->name('supplyAttachmentCategoryDelete')->option([
'_alias' => '删除',
]);
})->prefix('admin.system.attachment.AttachmentCategory')->option([
'_path' => '/config/picture',
'_auth' => true,
]);
})->middleware(AllowOriginMiddleware::class)
->middleware(MerchantTokenMiddleware::class, true)
->middleware(MerchantAuthMiddleware::class)
->middleware(MerchantCheckBaseInfoMiddleware::class)
->middleware(LogMiddleware::class);

36
route/supply/config.php Normal file
View File

@ -0,0 +1,36 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
use app\common\middleware\AllowOriginMiddleware;
use app\common\middleware\LogMiddleware;
use app\common\middleware\MerchantAuthMiddleware;
use app\common\middleware\MerchantTokenMiddleware;
use think\facade\Route;
use app\common\middleware\MerchantCheckBaseInfoMiddleware;
Route::group(function () {
Route::get('config/:key', 'admin.system.config.Config/form')->name('supplyConfigForm')->option([
'_alias' => '配置获取',
'_path' => 'config',
'_auth' => false,
]);
Route::post('config/save/:key', 'admin.system.config.ConfigValue/save')->name('supplyConfigSave')->option([
'_alias' => '配置保存',
'_path' => 'config',
'_auth' => false,
]);
})->middleware(AllowOriginMiddleware::class)
->middleware(MerchantTokenMiddleware::class, true)
->middleware(MerchantAuthMiddleware::class)
->middleware(MerchantCheckBaseInfoMiddleware::class)
->middleware(LogMiddleware::class);

109
route/supply/coupon.php Normal file
View File

@ -0,0 +1,109 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
use app\common\middleware\AllowOriginMiddleware;
use app\common\middleware\LogMiddleware;
use app\common\middleware\MerchantAuthMiddleware;
use app\common\middleware\MerchantTokenMiddleware;
use think\facade\Route;
use app\common\middleware\MerchantCheckBaseInfoMiddleware;
Route::group(function () {
//发送优惠券
Route::get('store/coupon/product/:id', 'admin.store.Coupon/product')->name('supplyCouponProduct')->option([
'_alias' => '优惠券可用商品',
'_path' => '/user/list',
'_auth' => true,
]);
Route::get('store/coupon_send/lst', 'supply.store.coupon.CouponSend/lst')->name('supplyCouponSendLst')->option([
'_alias' => '发送优惠券记录',
'_path' => '/marketing/coupon/send',
'_auth' => true,
]);
//优惠券
Route::group('store/coupon', function () {
Route::get('create/form', '/createForm')->name('supplyCouponCreateForm')->option([
'_alias' => '添加表单',
'_auth' => false,
'_form' => 'supplyCouponCreate',
]);
Route::get('clone/form/:id', '/cloneForm')->name('supplyCouponIssueCloneForm')->option([
'_alias' => '复制表单',
'_auth' => false,
'_form' => 'supplyCouponCreate',
]);
Route::post('create', '/create')->name('supplyCouponCreate')->option([
'_alias' => '添加',
]);
Route::post('status/:id', '/changeStatus')->name('supplyCouponIssueChangeStatus')->option([
'_alias' => '修改状态',
]);
Route::get('lst', '/lst')->name('supplyCouponLst')->option([
'_alias' => '列表',
]);
Route::get('issue', '/issue')->name('supplyCouponIssue')->option([
'_alias' => '使用记录',
'_path' => '/marketing/coupon/user',
]);
Route::get('select', '/select')->option([
'_alias' => '筛选',
'_auth' => false,
]);
Route::delete('delete/:id', '/delete')->name('supplyCouponDelete')->option([
'_alias' => '删除',
]);
Route::get('detail/:id', '/detail')->name('supplyCouponDetail')->option([
'_alias' => '详情',
]);
Route::get('update/:id/form', '/updateForm')->name('systemCouponUpdateForm')->option([
'_alias' => '编辑表单',
'_auth' => false,
'_form' => 'systemCouponUpdate',
]);
Route::post('update/:id', '/update')->name('systemCouponUpdate')->option([
'_alias' => '编辑',
]);
})->prefix('supply.store.coupon.Coupon')->option([
'_alias' => '配置保存',
'_path' => '/marketing/coupon/list',
'_auth' => true,
'_append'=> [
[
'_name' =>'supplyUploadImage',
'_path' =>'/marketing/coupon/list',
'_alias' => '上传图片',
'_auth' => true,
],
[
'_name' =>'supplyAttachmentLst',
'_path' =>'/marketing/coupon/list',
'_alias' => '图片列表',
'_auth' => true,
],
]
]);
Route::post('store/coupon/send', 'supply.store.coupon.Coupon/send')
->name('supplyCouponSendCoupon')->option([
'_alias' => '发送优惠券',
'_path' => '/user/list',
'_auth' => true,
]);
})->middleware(AllowOriginMiddleware::class)
->middleware(MerchantTokenMiddleware::class, true)
->middleware(MerchantAuthMiddleware::class)
->middleware(MerchantCheckBaseInfoMiddleware::class)
->middleware(LogMiddleware::class);

191
route/supply/delivery.php Normal file
View File

@ -0,0 +1,191 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
use app\common\middleware\AllowOriginMiddleware;
use app\common\middleware\LogMiddleware;
use app\common\middleware\MerchantAuthMiddleware;
use app\common\middleware\MerchantTokenMiddleware;
use think\facade\Route;
use app\common\middleware\MerchantCheckBaseInfoMiddleware;
Route::group(function () {
//快递公司
Route::group('expr',function(){
Route::get('/lst','/lst')->name('supplyServeExportLst')->option([
'_alias' => '列表',
]);
Route::get('/options','/options')->option([
'_alias' => '列表',
'_auth' => false,
]);
Route::get('/partner/:id/form','/partnerForm')->name('supplyExpressPratnerUpdateForm')->option([
'_alias' => '月结账号编辑表单',
'_auth' => false,
'_form' => 'supplyExpressPratnerUpdate',
]);
Route::post('/partner/:id','/partner')->name('supplyExpressPratnerUpdate')->option([
'_alias' => '月结账号编辑',
]);
})->prefix('admin.store.Express')->option([
'_path' => '/config/freight/express',
'_auth' => true,
]);
//同城配送
Route::group('delivery/station', function () {
//获取分类
Route::get('business','/getBusiness')->name('supplyStoreDeliveryBusiness')->option([
'_alias' => '获取分类',
]);
//添加
Route::post('create','/create')->name('supplyStoreDeliveryCreate')->option([
'_alias' => '添加',
]);
//编辑
Route::post('update/:id','/update')->name('supplyStoreDeliveryUpdate')->option([
'_alias' => '编辑',
]);
//编辑状态
Route::post('status/:id','/switchWithStatus')->name('supplyStoreDeliveryStatus')->option([
'_alias' => '编辑状态',
]);
//列表
Route::get('lst','/lst')->name('supplyStoreDeliveryLst')->option([
'_alias' => '列表',
]);
//详情
Route::get('detail/:id','/detail')->name('supplyStoreDeliveryDetail')->option([
'_alias' => '详情',
]);
//删除
Route::delete('delete/:id','/delete')->name('supplyStoreDeliveryDelete')->option([
'_alias' => '删除',
]);
//备注
Route::get('mark/:id/form','/markForm')->name('supplyStoreDeliveryMarkForm')->option([
'_alias' => '备注表单',
'_auth' => false,
'_form' => 'supplyStoreDeliveryMark',
]);
Route::post('mark/:id','/mark')->name('supplyStoreDeliveryMark')->option([
'_alias' => '备注',
]);
Route::get('options','/options')->option([
'_alias' => '列表',
'_auth' => false,
]);
Route::get('select','/select')->option([
'_alias' => '列表',
'_auth' => false,
]);
//城市列表
Route::get('getCity','/getCityLst')->name('supplyStoreDeliveryCityList')->option([
'_alias' => '城市列表',
]);
//充值记录
Route::get('payLst','/payLst')->name('supplyStoreDeliveryPayLst')->option([
'_alias' => '充值记录',
'_path' => '/delivery/recharge_record',
]);
Route::get('code','/getQrcode')->name('supplyStoreDeliveryGetQrcode')->option([
'_alias' => '充值二维码',
'_path' => '/delivery/recharge_record',
'_auth' => false,
]);
})->prefix('supply.store.delivery.DeliveryStation')->option([
'_path' => '/delivery/store_manage',
'_auth' => true,
]);
//同城配送
Route::group('delivery/order', function () {
//
Route::get('lst','/lst')
->name('supplyStoreDeliveryOrderLst')->option([
'_alias' => '列表',
]);
//取消
Route::get('cancel/:id/form','/cancelForm')
->name('supplyStoreDeliveryOrderCancelForm')->option([
'_alias' => '取消表单',
'_auth' => false,
'_form' => 'supplyStoreDeliveryOrderCancel',
]);
Route::post('cancel/:id','/cancel')
->name('supplyStoreDeliveryOrderCancel')->option([
'_alias' => '取消',
]);
//详情
Route::get('detail/:id','/detail')
->name('supplyStoreDeliveryOrderDetail')->option([
'_alias' => '详情',
]);
})->prefix('supply.store.delivery.DeliveryOrder')->option([
'_path' => '/delivery/usage_record',
'_auth' => true,
]);
//运费模板
Route::group('store/shipping', function () {
Route::get('lst', '/lst')->name('supplyStoreShippingTemplateLst')->option([
'_alias' => '列表',
'_auth' => false,
]);
Route::get('list', '/getList')->option([
'_alias' => '列表 ',
]);
Route::post('create', '/create')->name('supplyStoreShippingTemplateCreate')->option([
'_alias' => '添加 ',
]);
Route::post('update/:id', '/update')->name('supplyStoreShippingTemplateUpdate')->option([
'_alias' => '编辑',
]);
Route::get('detail/:id', '/detail')->name('supplyStoreShippingTemplateDetail')->option([
'_alias' => '详情',
]);
Route::delete('delete/:id', '/delete')->name('supplyStoreShippingTemplateDelete')->option([
'_alias' => '删除',
]);
Route::get('setDefault/:id', '/setDefault')->name('supplyStoreShippingTemplateSetDefault')->option([
'_alias' => '设置默认模板',
]);
})->prefix('supply.store.shipping.ShippingTemplate')->option([
'_path' => '/config/freight/shippingTemplates',
'_auth' => true,
]);
//地址信息
Route::get('system/city/lst', 'supply.store.shipping.City/lst')->option([
'_alias' => '列表',
'_auth' => false,
]);
Route::get('v2/system/city/lst/:pid', 'supply.store.shipping.City/lstV2')->option([
'_alias' => '列表',
'_auth' => false,
]);
})->middleware(AllowOriginMiddleware::class)
->middleware(MerchantTokenMiddleware::class, true)
->middleware(MerchantAuthMiddleware::class)
->middleware(MerchantCheckBaseInfoMiddleware::class)
->middleware(LogMiddleware::class);

109
route/supply/diy.php Normal file
View File

@ -0,0 +1,109 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
use think\facade\Route;
use app\common\middleware\LogMiddleware;
use app\common\middleware\AllowOriginMiddleware;
use app\common\middleware\MerchantAuthMiddleware;
use app\common\middleware\MerchantTokenMiddleware;
use app\common\middleware\MerchantCheckBaseInfoMiddleware;
Route::group(function () {
Route::get('diy/link/getLinks/:id', 'admin.system.diy.PageLink/getLinks')->option([
'_alias' => '列表',
'_auth' => false,
]);
Route::get('diy/link/lst', 'admin.system.diy.PageLink/lst')->name('supplyDiyPageLinkLst')->option([
'_alias' => '列表',
'_path' => '/devise/diy/list',
])->append(['type' => 1]);
Route::get('diy/categroy/options', 'admin.system.diy.PageCategroy/options')->option([
'_alias' => '列表 ',
'_auth' => false,
])->append(['type' => 1]);
Route::group('diy/', function () {
Route::get('lst', '/lst')->name('supplyDiyLst')->option([
'_alias' => '列表 ',
]);
Route::get('review/:id', '/review');
Route::get('default_lst', '/defaultLst')->name('supplyDefaultDiyLst')->option([
'_alias' => '默认模板列表 ',
]);
Route::get('detail/:id', '/getInfo')->name('supplyDiyDetail')->option([
'_alias' => '详情 ',
]);
Route::post('create/:id', '/saveData')->name('supplyDiyCreate')->option([
'_alias' => '添加/编辑',
]);
Route::post('status/:id', '/setStatus')->name('supplyDiyStatus')->option([
'_alias' => '使用模板',
]);
Route::post('set_default_data/:id', '/setDefaultData')->name('supplyDiySetDefault')->option([
'_alias' => '使用模板',
]);
Route::get('recovery/:id', '/recovery/')->name('supplyDiyRecovery')->option([
'_alias' => '重置模板',
]);
Route::get('show', '/getDiyInfo')->name('supplyDiyInfo')->option([
'_alias' => '当前使用模板',
]);
Route::delete('delete/:id', '/del')->name('supplyDiyDelete')->option([
'_alias' => '删除',
]);
Route::get('product/lst', '/productLst')->name('supplyDiyProductLst')->option([
'_alias' => '店铺街装修',
]);
Route::get('copy/:id', '/copy')->name('supplyDiyCopy')->option([
'_alias' => '复制',
]);
})->prefix('supply.system.diy.Diy')->option([
'_path' => '/devise/diy/list',
'_auth' => true,
'_append'=> [
[
'_name' =>'uploadImage',
'_path' =>'/devise/diy/list',
'_alias' => '上传图片',
'_auth' => true,
],
[
'_name' =>'systemAttachmentLst',
'_path' =>'/devise/diy/list',
'_alias' => '图片列表',
'_auth' => true,
],
]
]);
})->middleware(AllowOriginMiddleware::class)
->middleware(MerchantTokenMiddleware::class, true)
->middleware(MerchantAuthMiddleware::class)
->middleware(MerchantCheckBaseInfoMiddleware::class)
->middleware(LogMiddleware::class);

54
route/supply/form.php Normal file
View File

@ -0,0 +1,54 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
use think\facade\Route;
use app\common\middleware\AdminAuthMiddleware;
use app\common\middleware\AdminTokenMiddleware;
use app\common\middleware\AllowOriginMiddleware;
use app\common\middleware\LogMiddleware;
Route::group(function () {
Route::group('store/form',function () {
Route::post('create', '/create')->name('merFormCreate')->option([
'_alias' => '添加',
'_auth' => true,
]);
Route::post('update/:id', '/update')->name('merFormUpdate')->option([
'_alias' => '编辑',
'_auth' => true,
]);
Route::delete('delete/:id', '/delete')->name('merFormDelete')->option([
'_alias' => '删除',
'_auth' => true,
]);
Route::get('detail/:id', '/detail')->name('merFormDetail')->option([
'_alias' => '详情',
'_auth' => true,
]);
Route::get('lst', '/lst')->name('merFormLst')->option([
'_alias' => '列表',
'_auth' => true,
]);
Route::get('select', '/select');
Route::get('info/:id', '/info');
})->prefix('admin.system.form.Form')->option([
'_path' => '/form',
'_auth' => true,
]);
})->middleware(AllowOriginMiddleware::class)
->middleware(\app\common\middleware\MerchantTokenMiddleware::class, true)
->middleware(\app\common\middleware\MerchantAuthMiddleware::class)
->middleware(\app\common\middleware\MerchantCheckBaseInfoMiddleware::class)
->middleware(LogMiddleware::class);

74
route/supply/group.php Normal file
View File

@ -0,0 +1,74 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
use app\common\middleware\AllowOriginMiddleware;
use app\common\middleware\LogMiddleware;
use app\common\middleware\MerchantAuthMiddleware;
use app\common\middleware\MerchantCheckBaseInfoMiddleware;
use app\common\middleware\MerchantTokenMiddleware;
use think\facade\Route;
Route::group(function () {
Route::group('group', function () {
Route::get('detail/:id', '/get')->name('supplyGroupDetail')->option([
'_alias' => '数据详情',
]);
Route::get('data/lst/:groupId', 'Data/lst')->name('supplyGroupDataLst')->option([
'_alias' => '数据列表',
]);
Route::get('data/create/table/:groupId', 'Data/createTable')->name('supplyGroupDataCreateForm')->option([
'_alias' => '数据添加表单',
'_auth' => false,
'_form' => 'groupDataCreate',
]);
Route::post('data/create/:groupId', 'Data/create')->name('supplyGroupDataCreate')->option([
'_alias' => '数据添加',
]);
Route::get('data/update/table/:groupId/:id', 'Data/updateTable')->name('supplyGroupDataUpdateForm')->option([
'_alias' => '数据编辑表单',
'_auth' => false,
'_form' => 'groupDataUpdate',
]);
Route::post('data/update/:groupId/:id', 'Data/update')->name('supplyGroupDataUpdate')->option([
'_alias' => '数据编辑',
]);
Route::delete('data/delete/:id', 'Data/delete')->name('supplyGroupDataDelete')->option([
'_alias' => '数据删除',
]);
Route::post('data/status/:id', 'Data/changeStatus')->name('supplyGroupDataChangeStatus')->option([
'_alias' => '数据修改状态',
]);
Route::get('data/detail/:id', 'Data/baseDetail');
})->prefix('admin.system.groupData.Group')->option([
'_auth' => true,
'_init' => [ \crmeb\services\UpdateAuthInit::class,'groupData'],
'_append' => [
[
'_name' => 'uploadImage',
'_alias' => '上传图片',
'_auth' => true,
],
[
'_name' => 'systemAttachmentLst',
'_alias' => '图片列表',
'_auth' => true,
],
]
]);
})->middleware(AllowOriginMiddleware::class)
->middleware(MerchantTokenMiddleware::class, true)
->middleware(MerchantAuthMiddleware::class)
->middleware(MerchantCheckBaseInfoMiddleware::class)
->middleware(LogMiddleware::class);

496
route/supply/marketing.php Normal file
View File

@ -0,0 +1,496 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
use app\common\middleware\AllowOriginMiddleware;
use app\common\middleware\LogMiddleware;
use app\common\middleware\MerchantAuthMiddleware;
use app\common\middleware\MerchantTokenMiddleware;
use think\facade\Route;
use app\common\middleware\MerchantCheckBaseInfoMiddleware;
Route::group(function () {
//秒杀商品
Route::group('store/seckill_product', function () {
Route::get('lst_time', '/lst_time')->option([
'_alias' => '时间配置',
'_auth' => false,
]);
Route::get('lst_filter', '/getStatusFilter')->name('supplyStoreSeckillProductLstFilter')->option([
'_alias' => '统计',
]);
Route::get('lst', '/lst')->name('supplyStoreSeckillProductLst')->option([
'_alias' => '列表',
]);
Route::post('create', '/create')->name('supplyStoreSeckillProductCreate')->option([
'_alias' => '添加 ',
]);
Route::get('detail/:id', '/detail')->name('supplyStoreSeckillProductDetail')->option([
'_alias' => '详情',
]);
Route::post('update/:id', '/update')->name('supplyStoreSeckillProductUpdate')->option([
'_alias' => '编辑',
]);
Route::delete('delete/:id', '/delete')->name('supplyStoreSeckillProductDelete')->option([
'_alias' => '删除',
]);
Route::delete('destory/:id', '/destory')->name('supplyStoreSeckillProductDestory')->option([
'_alias' => '彻底删除',
]);
Route::post('restore/:id', '/restore')->name('supplyStoreSeckillProductRestore')->option([
'_alias' => '恢复',
]);
Route::post('status/:id', '/switchStatus')->name('supplyStoreSeckillProductSwitchStatus')->option([
'_alias' => '修改状态',
]);
Route::post('sort/:id', '/updateSort')->name('supplyStoreSeckillProductUpdateSort')->option([
'_alias' => '排序',
]);
Route::post('preview', '/preview')->name('supplyStoreSeckillProductPreview')->option([
'_alias' => '预览',
]);
Route::post('labels/:id', '/setLabels')->name('supplyStoreSeckillProductLabels')->option([
'_alias' => '设置标签',
]);
})->prefix('supply.store.product.ProductSeckill')->option([
'_path' => '/marketing/seckill/list',
'_auth' => true,
'_append'=> [
[
'_name' =>'supplyUploadImage',
'_path' =>'/marketing/seckill/list',
'_alias' => '上传图片',
'_auth' => true,
],
[
'_name' =>'supplyAttachmentLst',
'_path' =>'/marketing/seckill/list',
'_alias' => '图片列表',
'_auth' => true,
],
]
]);
//预售商品
Route::group('store/product/presell', function () {
Route::get('lst', '/lst')->name('supplyStoreProductPresellLst')->option([
'_alias' => '列表',
]);
Route::post('create', '/create')->name('supplyStoreProductPresellCreate')->option([
'_alias' => '添加',
]);
Route::get('detail/:id', '/detail')->name('supplyStoreProductPresellDetail')->option([
'_alias' => '详情',
]);
Route::post('update/:id', '/update')->name('supplyStoreProductPresellUpdate')->option([
'_alias' => '编辑',
]);
Route::delete('delete/:id', '/delete')->name('supplyStoreProductPresellDelete')->option([
'_alias' => '删除',
]);
Route::post('status/:id', '/switchStatus')->name('supplyStoreProductPresellStatus')->option([
'_alias' => '修改状态',
]);
Route::get('number', '/number')->option([
'_alias' => '统计',
'_auth' => false,
]);
Route::post('sort/:id', '/updateSort')->name('supplyStoreProductPresellUpdateSort')->option([
'_alias' => '排序',
]);
Route::post('preview', '/preview')->name('supplyStoreProductPresellPreview')->option([
'_alias' => '预览',
]);
Route::post('labels/:id', '/setLabels')->name('supplyStoreProductPreselltLabels')->option([
'_alias' => '设置标签',
]);
})->prefix('supply.store.product.ProductPresell')->option([
'_path' => '/marketing/presell/list',
'_auth' => true,
'_append'=> [
[
'_name' =>'supplyUploadImage',
'_path' =>'/marketing/presell/list',
'_alias' => '上传图片',
'_auth' => true,
],
[
'_name' =>'supplyAttachmentLst',
'_path' =>'/marketing/presell/list',
'_alias' => '图片列表',
'_auth' => true,
],
]
]);
//助力商品
Route::group('store/product/assist', function () {
Route::get('lst', '/lst')->name('supplyStoreProductAssistLst')->option([
'_alias' => '列表 ',
]);
Route::post('create', '/create')->name('supplyStoreProductAssistCreate')->option([
'_alias' => '添加',
]);
Route::get('detail/:id', '/detail')->name('supplyStoreProductAssistDetail')->option([
'_alias' => '详情',
]);
Route::post('update/:id', '/update')->name('supplyStoreProductAssistUpdate')->option([
'_alias' => '编辑',
]);
Route::delete('delete/:id', '/delete')->name('supplyStoreProductAssistDelete')->option([
'_alias' => '删除',
]);
Route::post('status/:id', '/switchStatus')->name('supplyStoreProductAssistStatus')->option([
'_alias' => '修改状态',
]);
Route::post('sort/:id', '/updateSort')->name('supplyStoreProductAssistUpdateSort')->option([
'_alias' => '排序',
]);
Route::post('preview', '/preview')->name('supplyStoreProductAssistPreview')->option([
'_alias' => '预览',
]);
Route::post('labels/:id', '/setLabels')->name('supplyStoreProductAssistLabels')->option([
'_alias' => '设置标签',
]);
})->prefix('supply.store.product.ProductAssist')->option([
'_path' => '/marketing/assist/list',
'_auth' => true,
'_append'=> [
[
'_name' =>'supplyUploadImage',
'_path' =>'/marketing/assist/list',
'_alias' => '上传图片',
'_auth' => true,
],
[
'_name' =>'supplyAttachmentLst',
'_path' =>'/marketing/assist/list',
'_alias' => '图片列表',
'_auth' => true,
],
]
]);
//助力活动
Route::group('store/product/assist_set', function () {
Route::get('lst', '/lst')->name('supplyStoreProductAssistSetLst')->option([
'_alias' => '活动列表',
]);
Route::get('detail/:id', '/detail')->name('supplyStoreProductAssistSetDetail')->option([
'_alias' => '活动详情',
]);
})->prefix('supply.store.product.ProductAssistSet')->option([
'_path' => '/marketing/assist/assist_set',
'_auth' => true,
]);
//拼团商品
Route::group('store/product/group', function () {
Route::get('lst', '/lst')->name('supplyStoreProductGroupLst')->option([
'_alias' => '列表',
]);
Route::post('create', '/create')->name('supplyStoreProductGroupCreate')->option([
'_alias' => '添加',
]);
Route::get('detail/:id', '/detail')->name('supplyStoreProductGroupDetail')->option([
'_alias' => '详情',
]);
Route::post('update/:id', '/update')->name('supplyStoreProductGroupUpdate')->option([
'_alias' => '编辑',
]);
Route::delete('delete/:id', '/delete')->name('supplyStoreProductGroupDelete')->option([
'_alias' => '删除',
]);
Route::post('status/:id', '/switchStatus')->name('supplyStoreProductGroupStatus')->option([
'_alias' => '修改状态',
]);
Route::post('sort/:id', '/updateSort')->name('supplyStoreProductGroupSort')->option([
'_alias' => '排序',
]);
Route::post('preview', '/preview')->name('supplyStoreProductGroupPreview')->option([
'_alias' => '预览',
]);
Route::post('labels/:id', '/setLabels')->name('supplyStoreProductGroupLabels')->option([
'_alias' => '设置标签',
]);
})->prefix('supply.store.product.ProductGroup')->option([
'_path' => '/marketing/combination/combination_goods',
'_auth' => true,
'_append'=> [
[
'_name' =>'supplyUploadImage',
'_path' =>'/marketing/combination/combination_goods',
'_alias' => '上传图片',
'_auth' => true,
],
[
'_name' =>'supplyAttachmentLst',
'_path' =>'/marketing/combination/combination_goods',
'_alias' => '图片列表',
'_auth' => true,
],
]
]);
Route::get('config/others/group_buying', 'admin.system.config.ConfigOthers/getGroupBuying')
->name('supplyConfigGroupBuying')->option([
'_alias' => '拼团配置',
'_path' => '/marketing/combination/combination_goods',
'_auth' => true,
]);;
//拼团活动
Route::group('store/product/group/buying', function () {
Route::get('lst', '/lst')->name('supplyStoreProductGroupBuyingLst')->option([
'_alias' => '活动列表 ',
]);
Route::get('detail/:id', '/detail')->name('supplyStoreProductGroupBuyingDetail')->option([
'_alias' => '活动详情',
]);
})->prefix('supply.store.product.ProductGroupBuying')->option([
'_path' => '/marketing/combination/combination_list',
'_auth' => true,
'_append'=> [
[
'_name' =>'supplyUploadImage',
'_path' =>'/marketing/combination/combination_list',
'_alias' => '上传图片',
'_auth' => true,
],
[
'_name' =>'supplyAttachmentLst',
'_path' =>'/marketing/combination/combination_list',
'_alias' => '图片列表',
'_auth' => true,
],
]
]);
//直播间
Route::group('broadcast/room', function () {
Route::get('lst', '/lst')->name('supplyBroadcastRoomLst')->option([
'_alias' => '列表 ',
]);
Route::get('detail/:id', '/detail')->name('supplyBroadcastRoomDetail')->option([
'_alias' => '详情',
]);
Route::get('create/form', '/createForm')->name('supplyBroadcastRoomCreateForm')->option([
'_alias' => '添加表单',
'_auth' => false,
'_form' => 'supplyBroadcastRoomCreate',
]);
Route::post('create', '/create')->name('supplyBroadcastRoomCreate')->option([
'_alias' => '添加',
]);
Route::get('update/form/:id', '/updateForm')->name('supplyBroadcastRoomUpdateForm')->option([
'_alias' => '编辑表单',
'_auth' => false,
'_form' => 'supplyBroadcastRoomUpdate',
]);
Route::post('update/:id', '/update')->name('supplyBroadcastRoomUpdate')->option([
'_alias' => '编辑',
]);
Route::post('status/:id', '/changeStatus')->name('supplyBroadcastRoomChangeStatus')->option([
'_alias' => '修改状态',
]);
Route::post('export_goods', '/exportGoods')->name('supplyBroadcastRoomExportGoods')->option([
'_alias' => '导入商品',
]);
Route::post('rm_goods', '/rmExportGoods')->name('supplyBroadcastRoomRmExportGoods')->option([
'_alias' => '删除商品',
]);
Route::post('mark/:id', '/mark')->name('supplyBroadcastRoomMark')->option([
'_alias' => '备注',
]);
Route::get('goods/:id', '/goodsList')->name('supplyBroadcastRoomGoods')->option([
'_alias' => '商品详情',
]);
Route::post('closeKf/:id', '/closeKf')->name('supplyBroadcastRoomCloseKf')->option([
'_alias' => '关闭客服',
]);
Route::post('comment/:id', '/banComment')->name('supplyBroadcastRoomCloseComment')->option([
'_alias' => '禁言',
]);
Route::post('feedsPublic/:id', '/isFeedsPublic')->name('supplyBroadcastRoomCloseFeeds')->option([
'_alias' => '收录',
]);
Route::post('on_sale/:id', '/onSale')->name('supplyBroadcastOnSale')->option([
'_alias' => '商品上下架',
]);
Route::delete('delete/:id', '/delete')->name('supplyBroadcastRoomDelete')->option([
'_alias' => '删除',
]);
Route::get('addassistant/form/:id', '/addAssistantForm')->name('supplyBroadcastAddAssistantForm')->option([
'_alias' => '添加客服表单',
'_auth' => false,
'_form' => 'supplyBroadcastAddAssistant',
]);
Route::post('addassistant/:id', '/addAssistant')->name('supplyBroadcastAddAssistant')->option([
'_alias' => '添加 客服',
]);
Route::get('push_message/:id', '/pushMessage')->name('supplyBroadcastPushMessage')->option([
'_alias' => '消息推送',
]);
})->prefix('supply.store.broadcast.BroadcastRoom')->option([
'_path' => '/marketing/studio/list',
'_auth' => true,
'_append'=> [
[
'_name' =>'supplyUploadImage',
'_path' =>'/marketing/studio/list',
'_alias' => '上传图片',
'_auth' => true,
],
[
'_name' =>'supplyAttachmentLst',
'_path' =>'/marketing/studio/list',
'_alias' => '图片列表',
'_auth' => true,
],
]
]);
//直播小助手
Route::group('broadcast/assistant', function () {
Route::get('lst', '/lst')->name('supplyBroadcastAssistantLst')->option([
'_alias' => '列表',
]);
Route::get('create/form', '/createForm')->name('supplyBroadcastAssistantCreateForm')->option([
'_alias' => '添加表单',
'_auth' => false,
'_form' => 'supplyBroadcastAssistantCreate',
]);
Route::post('create', '/create')->name('supplyBroadcastAssistantCreate')->option([
'_alias' => '添加',
]);
Route::get('update/:id/form', '/updateForm')->name('supplyBroadcastAssistantUpdateForm')->option([
'_alias' => '编辑表单',
'_auth' => false,
'_form' => 'supplyBroadcastAssistantUpdate',
]);
Route::post('update/:id', '/update')->name('supplyBroadcastAssistantUpdate')->option([
'_alias' => '编辑',
]);
Route::post('mark/:id', '/mark')->name('supplyBroadcastAssistantMark')->option([
'_alias' => '备注',
]);
Route::delete('delete/:id', '/delete')->name('supplyBroadcastAssistantDelete')->option([
'_alias' => '删除',
]);
})->prefix('supply.store.broadcast.BroadcastAssistant')->option([
'_path' => '/marketing/studio/assistant',
'_auth' => true,
'_append'=> [
[
'_name' =>'supplyUploadImage',
'_path' =>'/marketing/studio/assistant',
'_alias' => '上传图片',
'_auth' => true,
],
[
'_name' =>'supplyAttachmentLst',
'_path' =>'/marketing/studio/assistant',
'_alias' => '图片列表',
'_auth' => true,
],
]
]);
//直播间商品
Route::group('broadcast/goods', function () {
Route::get('lst', '/lst')->name('supplyBroadcastGoodsLst')->option([
'_alias' => '列表',
]);
Route::get('detail/:id', '/detail')->name('supplyBroadcastGoodsDetail')->option([
'_alias' => '详情',
]);
Route::get('create/form', '/createForm')->name('supplyBroadcastGoodsCreateForm')->option([
'_alias' => '添加表单',
'_auth' => false,
'_form' => 'supplyBroadcastGoodsCreate',
]);
Route::post('create', '/create')->name('supplyBroadcastGoodsCreate')->option([
'_alias' => '添加',
]);
Route::get('update/form/:id', '/updateForm')->name('supplyBroadcastGoodsUpdateForm')->option([
'_alias' => '编辑表单',
'_auth' => false,
'_form' => 'supplyBroadcastGoodsUpdate',
]);
Route::post('update/:id', '/update')->name('supplyBroadcastGoodsUpdate')->option([
'_alias' => '编辑',
]);
Route::post('status/:id', '/changeStatus')->name('supplyBroadcastGoodsChangeStatus')->option([
'_alias' => '修改状态',
]);
Route::post('mark/:id', '/mark')->name('supplyBroadcastGoodsMark')->option([
'_alias' => '备注',
]);
Route::delete('delete/:id', '/delete')->name('supplyBroadcastGoodsDelete')->option([
'_alias' => '删除',
]);
Route::post('batch_create', '/batchCreate')->name('supplyBroadcastGoodsbatchCreate')->option([
'_alias' => '批量添加',
]);
})->prefix('supply.store.broadcast.BroadcastGoods')->option([
'_path' => '/marketing/studio/list',
'_auth' => true,
'_append'=> [
[
'_name' =>'supplyUploadImage',
'_path' =>'/marketing/studio/list',
'_alias' => '上传图片',
'_auth' => true,
],
[
'_name' =>'supplyAttachmentLst',
'_path' =>'/marketing/studio/list',
'_alias' => '图片列表',
'_auth' => true,
],
]
]);
//积分
Route::group('integral',function(){
Route::get('lst','/getList')->name('supplyIntegralList')->option([
'_alias' => '列表',
]);
Route::get('title','/getTitle')->name('supplyIntegralTitle')->option([
'_alias' => '统计',
]);
})->prefix('supply.user.UserIntegral')->option([
'_path' => '/marketing/integral/log',
'_auth' => true,
'_append'=> [
[
'_name' =>'supplyConfigForm',
'_path' =>'/marketing/integral/log',
'_alias' => '配置获取',
'_auth' => true,
],
[
'_name' =>'supplyConfigSave',
'_path' =>'/marketing/integral/log',
'_alias' => '配置保存',
'_auth' => true,
],
]
]);
})->middleware(AllowOriginMiddleware::class)
->middleware(MerchantTokenMiddleware::class, true)
->middleware(MerchantAuthMiddleware::class)
->middleware(MerchantCheckBaseInfoMiddleware::class)
->middleware(LogMiddleware::class);

33
route/supply/notLogin.php Normal file
View File

@ -0,0 +1,33 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
use think\facade\Route;
use app\common\middleware\AllowOriginMiddleware;
//不带token认证
Route::group(function () {
Route::get('test', 'supply.system.admin.Login/test');
//验证码
Route::get('captcha', 'supply.system.admin.Login/getCaptcha');
//登录
Route::post('login', 'supply.system.admin.Login/login');
Route::post('ajstatus', 'supply.system.admin.Login/ajCaptchaStatus');
Route::get('login_config', 'admin.Common/loginConfig');
//滑块验证码
Route::get('ajcaptcha', 'api.Auth/ajcaptcha');
Route::post('ajcheck', 'api.Auth/ajcheck');
})->middleware(AllowOriginMiddleware::class)->option([
'_auth' => false,
]);

60
route/supply/openapi.php Normal file
View File

@ -0,0 +1,60 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
use app\common\middleware\AllowOriginMiddleware;
use app\common\middleware\LogMiddleware;
use app\common\middleware\MerchantAuthMiddleware;
use app\common\middleware\MerchantTokenMiddleware;
use think\facade\Route;
use app\common\middleware\MerchantCheckBaseInfoMiddleware;
Route::group(function () {
Route::group('openapi/',function(){
Route::get('lst','OpenApi/lst')->name('supplyOpenapiLst')->option([
'_alias' => '列表',
]);
Route::get('create/form','OpenApi/createForm')->name('supplyOpenapiCreateForm')->option([
'_alias' => '添加Form',
'_auth' => false,
'_form' => 'supplyOpenapiCreate',
]);
Route::post('create','OpenApi/create')->name('supplyOpenapiCreate')->option([
'_alias' => '添加',
]);
Route::get('update/:id/form','OpenApi/updateForm')->name('supplyOpenapiUpdateForm')->option([
'_alias' => '编辑Form',
'_auth' => false,
'_form' => 'supplyOpenapiUpdate',
]);
Route::post('update/:id','OpenApi/update')->name('supplyOpenapiUpdate')->option([
'_alias' => '编辑',
]);
Route::post('status/:id','OpenApi/switchWithStatus')->name('supplyOpenapiStatus')->option([
'_alias' => '修改状态',
]);
Route::delete('delete/:id','OpenApi/delete')->name('supplyOpenapiDeleta')->option([
'_alias' => '删除',
]);
Route::get('get_secret_key/:id','OpenApi/getSecretKey')->name('supplyOpenapiGetSecretKey')->option([
'_alias' => '查看',
]);
Route::post('set_secret_key/:id','OpenApi/setSecretKey')->name('supplyOpenapiSetSecretKey')->option([
'_alias' => '重置',
]);
})->prefix('supply.system.openapi.')->option([
'_path' => '/systemForm/openAuth/list',
'_auth' => true,
]);
})->middleware(AllowOriginMiddleware::class)
->middleware(MerchantTokenMiddleware::class, true)
->middleware(MerchantAuthMiddleware::class)
->middleware(MerchantCheckBaseInfoMiddleware::class)
->middleware(LogMiddleware::class);

249
route/supply/order.php Normal file
View File

@ -0,0 +1,249 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
use app\common\middleware\AllowOriginMiddleware;
use app\common\middleware\LogMiddleware;
use app\common\middleware\MerchantAuthMiddleware;
use app\common\middleware\MerchantTokenMiddleware;
use think\facade\Route;
use app\common\middleware\MerchantCheckBaseInfoMiddleware;
Route::group(function () {
//电子面单
Route::group('expr',function(){
Route::get('/temps','/getExportTemp')->name('supplyServeExportTemps')->option([
'_alias' => '预览',
]);
Route::get('/dump_lst','/dumpLst')->name('supplyServeExportDumpLst')->option([
'_alias' => '默认模板',
]);
})->prefix('admin.system.serve.Export')->option([
'_path' => '/order/list',
'_auth' => true,
]);
//Order
Route::group('store/order', function () {
Route::get('excel', 'Order/excel')->name('supplyStoreOrderExcel')->option([
'_alias' => '导出',
]);
Route::get('printer/:id', 'Order/printer')->name('supplyStoreOrderPrinter')->option([
'_alias' => '打印小票',
]);
Route::get('chart', 'Order/chart')->name('supplyStoreOrderTitle')->option([
'_alias' => '统计',
]);
Route::get('filtter', 'Order/orderType')->name('supplyStoreOrderFiltter')->option([
'_alias' => '类型',
'_auth' => false,
]);
Route::get('lst', 'Order/lst')->name('supplyStoreOrderLst')->option([
'_alias' => '列表',
]);
Route::get('express/:id', 'Order/express')->name('supplyStoreOrderExpress')->option([
'_alias' => '快递查询',
]);
Route::post('delivery/:id', 'Order/delivery')->name('supplyStoreOrderDelivery')->option([
'_alias' => '发货',
]);
Route::post('delivery_batch', 'Order/batchDelivery')->name('supplyStoreOrderBatchDelivery')->option([
'_alias' => '批量发货',
]);
Route::get('delivery_export', 'Order/deliveryExport')->name('supplyStoreOrderDeliveryExport')->option([
'_alias' => '导出发货单',
]);
Route::get('title', 'Order/title')->name('supplyStoreOrderStat')->option([
'_alias' => '头部统计',
]);
Route::get('update/:id/form', 'Order/updateForm')->name('supplyStoreOrderUpdateForm')->option([
'_alias' => '编辑表单',
'_auth' => false,
'_form' => 'supplyStoreOrderUpdate',
]);
Route::post('update/:id', 'Order/update')->name('supplyStoreOrderUpdate')->option([
'_alias' => '编辑',
]);
Route::get('detail/:id', 'Order/detail')->name('supplyStoreOrderDetail')->option([
'_alias' => '详情',
]);
Route::get('log/:id', 'Order/status')->name('supplyStoreOrderLog')->option([
'_alias' => '操作记录',
]);
Route::get('remark/:id/form', 'Order/remarkForm')->name('supplyStoreOrderRemarkForm')->option([
'_alias' => '备注表单',
'_auth' => false,
'_form' => 'supplyStoreOrderRemark',
]);
Route::post('remark/:id', 'Order/remark')->name('supplyStoreOrderRemark')->option([
'_alias' => '备注',
]);
Route::get('verify/:code', 'Order/verifyDetail')->name('supplyStoreOrderVerifyDetail')->option([
'_alias' => '核销详情',
]);
Route::post('verify/:id', 'Order/verify')->name('supplyStoreOrderVerify')->option([
'_alias' => '核销',
]);
Route::post('delete/:id', 'Order/delete')->name('supplyStoreOrderDelete')->option([
'_alias' => '删除',
]);
Route::get('children/:id', 'Order/childrenList')->name('supplyStoreOrderChildrenList')->option([
'_alias' => '关联订单',
]);
})->prefix('supply.store.order.')->option([
'_path' => '/order/list',
'_auth' => true,
'_append'=> [
[
'_name' =>'supplyStoreExcelLst',
'_path' =>'/order/list',
'_alias' => '导出列表',
'_auth' => true,
],
[
'_name' =>'supplyStoreExcelDownload',
'_path' =>'/order/list',
'_alias' => '导出下载',
'_auth' => true,
],
]
]);
//Order
Route::group('store/order', function () {
Route::get('takechart', 'Order/takeChart')->name('supplyStoreTakeOrderTitle')->option([
'_alias' => '统计',
'_auth' => false,
]);
Route::get('take_title', 'Order/takeTitle')->name('supplyStoreOrderTakeTitle')->option([
'_alias' => '统计',
]);
Route::get('takelst', 'Order/takeLst')->name('supplyStoreTakeOrderLst')->option([
'_alias' => '列表',
]);
})->prefix('supply.store.order.')->option([
'_path' => '/order/cancellation',
'_auth' => true,
]);
Route::get('store/refundorder/refund_message', 'api.Common/refundMessage');
//退款订单
Route::group('store/refundorder', function () {
Route::get('check/:id', '/check');
Route::post('compute', '/compute');
Route::post('create', '/create')->name('supplyStoreRefundOrderCreate')->option([
'_alias' => '创建',
]);
Route::get('lst', '/lst')->name('supplyStoreRefundOrderLst')->option([
'_alias' => '列表',
]);
Route::get('detail/:id', '/detail')->name('supplyStoreRefundOrderDetail')->option([
'_alias' => '详情',
]);
Route::get('status/:id/form', '/switchStatusForm')->name('supplyStoreRefundOrderSwitchStatusForm')->option([
'_alias' => '审核表单',
'_auth' => false,
'_form' => 'supplyStoreRefundOrderSwitchStatus',
]);
Route::post('status/:id', '/switchStatus')->name('supplyStoreRefundOrderSwitchStatus')->option([
'_alias' => '审核',
]);
Route::post('refund/:id', '/refundPrice')->name('supplyStoreRefundOrderRefund')->option([
'_alias' => '收到退回商品后确认退款',
]);
Route::delete('delete/:id', '/delete')->name('supplyStoreRefundDelete')->option([
'_alias' => '删除',
]);
Route::get('mark/:id/form', '/markForm')->name('supplyStoreRefundMarkForm')->option([
'_alias' => '备注表单',
'_auth' => false,
'_form' => 'supplyStoreRefundMark',
]);
Route::post('mark/:id', '/mark')->name('supplyStoreRefundMark')->option([
'_alias' => '备注',
]);
Route::get('log/:id', '/log')->name('supplyStoreRefundLog')->option([
'_alias' => '操作记录',
]);
Route::get('express/:id', '/express')->name('supplyStoreRefundExpress')->option([
'_alias' => '快递查询',
]);
Route::get('excel', '/createExcel')->name('supplyStoreRefundCreateExcel')->option([
'_alias' => '导出',
]);
})->prefix('supply.store.order.RefundOrder')->option([
'_path' => '/order/refund',
'_auth' => true,
'_append'=> [
[
'_name' =>'supplyStoreExcelLst',
'_path' =>'/order/refund',
'_alias' => '导出列表',
'_auth' => true,
],
[
'_name' =>'supplyStoreExcelDownload',
'_path' =>'/order/refund',
'_alias' => '导出下载',
'_auth' => true,
],
]
]);
// 导入
Route::group('store/import', function () {
Route::post('/:type', 'StoreImport/import')->name('supplyStoreOrderDeliveryImport')->option([
'_alias' => '导入',
]);
Route::get('lst', 'StoreImport/lst')->name('supplyStoreOrderDeliveryImportLst')->option([
'_alias' => '导入记录',
]);
Route::get('detail/:id', 'StoreImport/detail')->name('supplyStoreOrderDeliveryImportDetail')->option([
'_alias' => '详情',
]);
Route::get('excel/:id', 'StoreImport/export')->name('supplyStoreOrderDeliveryImportExcel')->option([
'_alias' => '导出',
]);
})->prefix('supply.store.')->option([
'_path' => '/order/list',
'_auth' => true,
'_append'=> [
[
'_name' =>'supplyStoreExcelLst',
'_path' =>'/order/list',
'_alias' => '导出列表',
'_auth' => true,
],
[
'_name' =>'supplyStoreExcelDownload',
'_path' =>'/order/list',
'_alias' => '导出下载',
'_auth' => true,
],
]
]);
})->middleware(AllowOriginMiddleware::class)
->middleware(MerchantTokenMiddleware::class, true)
->middleware(MerchantAuthMiddleware::class)
->middleware(MerchantCheckBaseInfoMiddleware::class)
->middleware(LogMiddleware::class);

458
route/supply/product.php Normal file
View File

@ -0,0 +1,458 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
use app\common\middleware\AllowOriginMiddleware;
use app\common\middleware\LogMiddleware;
use app\common\middleware\MerchantAuthMiddleware;
use app\common\middleware\MerchantTokenMiddleware;
use think\facade\Route;
use app\common\middleware\MerchantCheckBaseInfoMiddleware;
Route::group(function () {
//参数模板
Route::group('store/params', function () {
Route::get('temp/lst', '/lst')->name('supplyStoreParameterTemplateLst')->option([
'_alias' => '列表',
]);
Route::get('temp/detail/:id', '/detail')->name('supplyStoreParameterTemplateDetail')->option([
'_alias' => '详情',
]);
Route::delete('temp/delete/:id', '/delete')->name('supplyStoreParameterTemplateDelete')->option([
'_alias' => '删除',
]);
Route::post('temp/create', '/create')->name('supplyStoreParameterTemplateCreate')->option([
'_alias' => '添加',
]);
Route::post('temp/update/:id', '/update')->name('supplyStoreParameterTemplateUpdate')->option([
'_alias' => '编辑',
]);
Route::get('temp/select', '/select')->option([
'_alias' => '筛选列表',
'_auth' => false,
]);
Route::get('temp/show', '/show')->option([
'_alias' => '参数',
'_auth' => false,
]);
})->prefix('admin.parameter.ParameterTemplate')->option([
'_path' => '/product/specs',
'_auth' => true,
]);
//产品规则模板
Route::group('store/attr/template', function () {
Route::get('lst', '/lst')->name('supplyStoreAttrTemplateLst')->option([
'_alias' => '列表',
]);
Route::get('list', '/getlist')->option([
'_alias' => '筛选',
'_auth' => false,
]);
Route::post('create', '/create')->name('supplyStoreAttrTemplateCreate')->option([
'_alias' => '添加 ',
]);
Route::delete(':id', '/delete')->name('supplyStoreAttrTemplateDelete')->option([
'_alias' => '删除',
]);
Route::post(':id', '/update')->name('supplyStoreAttrTemplateUpdate')->option([
'_alias' => '文件类型',
]);
})->prefix('supply.store.StoreAttrTemplate')->option([
'_path' => '/product/attr',
'_auth' => true,
]);
//商品分类
Route::group('store/category', function () {
Route::get('create/form', '/createForm')->name('supplyStoreCategoryCreateForm')->option([
'_alias' => '添加表单',
'_auth' => false,
'_form' => 'supplyStoreCategoryCreate',
]);
Route::get('update/form/:id', '/updateForm')->name('supplyStoreCategoryUpdateForm')->option([
'_alias' => '编辑表单',
'_auth' => false,
'_form' => 'supplyStoreCategoryUpdate',
]);
Route::post('update/:id', '/update')->name('supplyStoreCategoryUpdate')->option([
'_alias' => '编辑',
]);
Route::get('lst', '/lst')->name('supplyStoreCategoryLst')->option([
'_alias' => '列表',
]);
Route::get('detail/:id', '/detail')->name('supplyStoreCategoryDtailt')->option([
'_alias' => '详情',
]);
Route::post('create', '/create')->name('supplyStoreCategoryCreate')->option([
'_alias' => '添加',
]);
Route::delete('delete/:id', '/delete')->name('supplyStoreCategoryDelete')->option([
'_alias' => '删除',
]);
Route::post('status/:id', '/switchStatus')->name('supplyStoreCategorySwitchStatus')->option([
'_alias' => '修改状态',
]);
Route::get('list', '/getList')->option([
'_alias' => '筛选',
'_auth' => false,
])->append(['type' => 1]);
Route::get('select', '/getTreeList')->option([
'_alias' => '树形',
'_auth' => false,
]);
Route::get('brandlist', '/BrandList')->option([
'_alias' => '品牌列表',
'_auth' => false,
]);
})->prefix('admin.store.StoreCategory')->option([
'_path' => '/product/classify',
'_auth' => true,
'_append'=> [
[
'_name' =>'supplyUploadImage',
'_path' =>'/product/classify',
'_alias' => '上传图片',
'_auth' => true,
],
[
'_name' =>'supplyAttachmentLst',
'_path' =>'/product/classify',
'_alias' => '图片列表',
'_auth' => true,
],
]
]);
//商品
Route::group('store/product', function () {
Route::get('config', '/config')->option([
'_alias' => '配置',
'_auth' => false,
]);
Route::get('lst_filter', '/getStatusFilter')->name('supplyStoreProductLstFilter')->option([
'_alias' => '头部统计',
]);
Route::get('lst', '/lst')->name('supplyStoreProductLst')->option([
'_alias' => '列表',
]);
Route::get('list', '/lst')->option([
'_alias' => '列表',
'_auth' => false,
]);
Route::post('create', '/create')->name('supplyStoreProductCreate')->option([
'_alias' => '添加',
]);
Route::get('detail/:id', '/detail')->name('supplyStoreProductDetail')->option([
'_alias' => '详情',
]);
Route::get('temp_key', '/temp_key')->name('supplyStoreProductTempKey')->option([
'_alias' => '上传视频配置',
]);
Route::post('update/:id', '/update')->name('supplyStoreProductUpdate')->option([
'_alias' => '编辑',
]);
Route::post('free_trial/:id', '/freeTrial')->name('supplyStoreProductFreeTrial')->option([
'_alias' => '免审编辑',
]);
Route::delete('delete/:id', '/delete')->name('supplyStoreProductDelete')->option([
'_alias' => '删除',
]);
Route::delete('destory/:id', '/destory')->name('supplyStoreProductDestory')->option([
'_alias' => '加入回收站',
]);
Route::post('restore/:id', '/restore')->name('supplyStoreProductRestore')->option([
'_alias' => '恢复',
]);
Route::post('status/:id', '/switchStatus')->name('supplyStoreProductSwitchStatus')->option([
'_alias' => '上下架',
]);
Route::post('batch_status', '/batchShow')->name('supplyStoreProductSwitchBatchStatus')->option([
'_alias' => '批量上下架',
]);
Route::post('batch_temp', '/batchTemplate')->name('supplyStoreProductSwitchBatchTemplate')->option([
'_alias' => '批量设置运费模板',
]);
Route::post('batch_labels', '/batchLabels')->name('supplyStoreProductSwitchBatchLabels')->option([
'_alias' => '批量设置标签',
]);
Route::post('batch_hot', '/batchHot')->name('supplyStoreProductSwitchBatchHot')->option([
'_alias' => '批量设置推荐',
]);
Route::post('batch_ext', '/batchExtension')->name('supplyStoreProductSwitchBatchExtension')->option([
'_alias' => '批量设置推荐',
]);
Route::post('batch_svip', '/batchSvipType')->name('supplyStoreProductSwitchBatchSvipType')->option([
'_alias' => '批量设置会员价',
]);
Route::post('sort/:id', '/updateSort')->name('supplyStoreProductUpdateSort')->option([
'_alias' => '排序',
]);
Route::post('preview', '/preview')->name('supplyStoreProductPreview')->option([
'_alias' => '预览',
]);
Route::post('labels/:id', '/setLabels')->name('supplyStoreProductLabels')->option([
'_alias' => '标签',
]);
Route::get('attr_value/:id', '/getAttrValue')->name('supplyStoreProductAttrValue')->option([
'_alias' => '获取规格',
]);
Route::post('get_attr_value/:id', '/isFormatAttr')->name('supplyStoreProductFormatAttr')->option([
'_alias' => '获取规格',
]);
Route::get('get_batch_list', '/getBatchList')->name('supplyStoreProductGetBatchList')->option([
'_alias' => '获取批量修改列表',
]);
Route::post('batch_process', '/batchProcess')->name('supplyStoreProductSwitchBatchProcess')->option([
'_alias' => '批量修改商品属性',
]);
Route::get('get_operate_list/:product_id', '/getOperateList')->name('supplyStoreProductGetOperateList')->option([
'_alias' => '操作记录',
]);
})->prefix('supply.store.product.Product')->option([
'_path' => '/product/list',
'_auth' => true,
'_append'=> [
[
'_name' =>'supplyUploadImage',
'_path' =>'/product/list',
'_alias' => '上传图片',
'_auth' => true,
],
[
'_name' =>'supplyAttachmentLst',
'_path' =>'/product/list',
'_alias' => '图片列表',
'_auth' => true,
],
]
]);
//复制商品
Route::group('store/productcopy', function () {
Route::get('lst', '/lst')->name('supplyStoreProductCopyLst')->option([
'_alias' => '列表',
]);
Route::get('get', '/get')->name('supplyStoreProductCopyGet')->option([
'_alias' => '获取信息',
]);
Route::get('count', '/count')->name('supplyStoreProductCopyCount')->option([
'_alias' => '统计',
]);
Route::post('save', '/save')->name('supplyStoreProductCopySave')->option([
'_alias' => '保存',
]);
})->prefix('supply.store.product.ProductCopy')->option([
'_path' => '/product/list',
'_auth' => true,
]);
//商品评价管理
Route::group('store/reply', function () {
Route::get('lst', '/lst')->name('supplyProductReplyLst')->option([
'_alias' => '列表',
]);
Route::get('form/:id', '/replyForm')->name('supplyProductReplyForm')->option([
'_alias' => '回复表单',
]);
Route::post('reply/:id', '/reply')->name('supplyProductReplyReply')->option([
'_alias' => '回复',
]);
})->prefix('admin.store.StoreProductReply')->option([
'_path' => '/product/reviews',
'_auth' => true,
'_append'=> [
[
'_name' =>'supplyUploadImage',
'_path' =>'/product/reviews',
'_alias' => '上传图片',
'_auth' => true,
],
[
'_name' =>'supplyAttachmentLst',
'_path' =>'/product/reviews',
'_alias' => '图片列表',
'_auth' => true,
],
]
]);
Route::group('store/reply', function () {
Route::post('sort/:id', '/changeSort')->name('supplyProductReplySort')->option([
'_alias' => '排序',
]);
})->prefix('supply.store.StoreProductReply')->option([
'_path' => '/product/reviews',
'_auth' => true,
]);;
//商品标签
Route::group('product/label', function () {
Route::get('lst', '/lst')->name('supplyStoreProductLabelLst')->option([
'_alias' => '列表',
]);
Route::get('create/form', '/createForm')->name('supplyStoreProductLabelCreateForm')->option([
'_alias' => '添加表单',
'_auth' => false,
'_form' => 'supplyStoreProductLabelCreate',
]);
Route::post('create', '/create')->name('supplyStoreProductLabelCreate')->option([
'_alias' => '添加',
]);
Route::get('update/:id/form', '/updateForm')->name('supplyStoreProductLabelUpdateForm')->option([
'_alias' => '编辑表单',
'_auth' => false,
'_form' => 'supplyStoreProductLabelUpdate',
]);
Route::post('update/:id', '/update')->name('supplyStoreProductLabelUpdate')->option([
'_alias' => '编辑',
]);
Route::get('detail/:id', '/detail')->name('supplyStoreProductLabelDetail')->option([
'_alias' => '详情',
]);
Route::delete('delete/:id', '/delete')->name('supplyStoreProductLabelDelete')->option([
'_alias' => '删除',
]);
Route::post('status/:id', '/switchWithStatus')->name('supplyStoreProductLabelStatus')->option([
'_alias' => '修改状态',
]);
Route::get('option', '/getOptions')->option([
'_alias' => '筛选',
'_auth' => false,
]);
})->prefix('supply.store.product.ProductLabel')->option([
'_path' => '/product/label',
'_auth' => true,
]);
Route::group('discounts/', function () {
Route::post('create','/create')->name('supplyStoreDiscountsCreate')->option([
'_alias' => '添加',
]);
Route::post('update/:id','/update')->name('supplyStoreDiscountsUpdate')->option([
'_alias' => '编辑',
]);
Route::get('lst','/lst')->name('supplyStoreDiscountsLst')->option([
'_alias' => '列表',
]);
Route::get('detail/:id','/detail')->name('supplyStoreDiscountsDetail')->option([
'_alias' => '详情',
]);
Route::delete('delete/:id','/delete')->name('supplyStoreDiscountsDelete')->option([
'_alias' => '删除',
]);
Route::post('status/:id','/switchStatus')->name('supplyStoreDiscountsStatus')->option([
'_alias' => '修改状态',
]);
})->prefix('supply.store.product.Discounts')->option([
'_path' => '/marketing/discounts/list',
'_auth' => true,
'_append'=> [
[
'_name' =>'supplyUploadImage',
'_path' =>'/marketing/discounts/list',
'_alias' => '上传图片',
'_auth' => true,
],
[
'_name' =>'supplyAttachmentLst',
'_path' =>'/marketing/discounts/list',
'_alias' => '图片列表',
'_auth' => true,
],
]
]);
//保障服务
Route::group('guarantee',function(){
Route::get('list','/list')->option([
'_alias' => '列表',
'_auth' => false,
]);
Route::get('select','/select')->option([
'_alias' => '筛选',
'_auth' => false,
]);
Route::get('lst','/lst')->name('supplyGuaranteeLst')->option([
'_alias' => '列表',
]);
Route::post('create','/create')->name('supplyGuaranteeCreate')->option([
'_alias' => '添加',
]);
Route::post('update/:id','/update')->name('supplyGuaranteeUpdate')->option([
'_alias' => '编辑',
]);
Route::get('detail/:id','/detail')->name('supplyGuaranteeDetail')->option([
'_alias' => '详情',
]);
Route::delete('delete/:id','/delete')->name('supplyGuaranteeDelete')->option([
'_alias' => '删除',
]);
Route::post('sort/:id','/sort')->name('supplyGuaranteeSort')->option([
'_alias' => '排序',
]);
Route::post('status/:id','/switchStatus')->name('supplyGuaranteeStatus')->option([
'_alias' => '修改状态',
]);
})->prefix('supply.store.guarantee.GuaranteeTemplate')->option([
'_path' => '/config/guarantee',
'_auth' => true,
]);
//商品单位
Route::group('product/unit', function () {
Route::get('list', '/list')->name('supplyStoreProductUnitLst')->option([
'_alias' => '商品单位列表',
]);
Route::get('create/form', '/createForm')->name('supplyStoreProductUnitCreateForm')->option([
'_alias' => '商品单位添加表单',
'_auth' => false,
'_form' => 'supplyStoreProductUnitCreate',
]);
Route::post('create', '/create')->name('supplyStoreProductUnitCreate')->option([
'_alias' => '商品单位添加',
]);
Route::get('update/:id/form', '/updateForm')->name('supplyStoreProductUnitUpdateForm')->option([
'_alias' => '商品单位编辑表单',
'_auth' => false,
'_form' => 'supplyStoreProductUnitUpdate',
]);
Route::post('update/:id', '/update')->name('supplyStoreProductUnitUpdate')->option([
'_alias' => '商品单位编辑',
]);
Route::delete('delete/:id', '/delete')->name('supplyStoreProductUnitDelete')->option([
'_alias' => '商品单位删除',
]);
Route::get('option', '/getSelectList')->option([
'_alias' => '筛选',
'_auth' => false,
]);
})->prefix('supply.store.product.ProductUnit')->option([
'_path' => '/product/unit',
'_auth' => true,
]);
})->middleware(AllowOriginMiddleware::class)
->middleware(MerchantTokenMiddleware::class, true)
->middleware(MerchantAuthMiddleware::class)
->middleware(MerchantCheckBaseInfoMiddleware::class)
->middleware(LogMiddleware::class);

129
route/supply/role.php Normal file
View File

@ -0,0 +1,129 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
use app\common\middleware\AllowOriginMiddleware;
use app\common\middleware\LogMiddleware;
use app\common\middleware\MerchantAuthMiddleware;
use app\common\middleware\MerchantTokenMiddleware;
use think\facade\Route;
use app\common\middleware\MerchantCheckBaseInfoMiddleware;
Route::group(function () {
//身份规则
Route::group('system/role', function () {
Route::get('lst', '/getList')->name('supplyRoleGetList')->option([
'_alias' => '列表',
'_auth' => false,
]);
Route::post('create', '/create')->name('supplyRoleCreate')->option([
'_alias' => '添加',
'_auth' => false,
]);
Route::get('create/form', '/createForm')->name('supplyRoleCreateForm')->option([
'_alias' => '添加表单',
'_auth' => false,
'_form' => 'supplyRoleCreate',
]);
Route::post('update/:id', '/update')->name('supplyRoleUpdate')->option([
'_alias' => '编辑',
'_auth' => false,
]);
Route::get('update/form/:id', '/updateForm')->name('supplyRoleUpdateForm')->option([
'_alias' => '编辑表单',
'_auth' => false,
'_form' => 'supplyRoleUpdate',
]);
Route::post('status/:id', '/switchStatus')->name('supplyRoleStatus')->option([
'_alias' => '修改状态',
'_auth' => false,
]);
Route::delete('delete/:id', '/delete')->name('supplyRoleDelete')->option([
'_alias' => '删除',
'_auth' => false,
]);
})->prefix('supply.system.auth.Role')->option([
'_path' => '/setting/systemRole',
'_auth' => true,
]);
//Admin管理
Route::group('system/admin', function () {
Route::get('lst', '/getList')->name('supplyAdminLst')->option([
'_alias' => '列表',
]);
Route::post('status/:id', '/switchStatus')->name('supplyAdminStatus')->option([
'_alias' => '修改状态',
]);
Route::post('create', '/create')->name('supplyAdminCreate')->option([
'_alias' => '添加',
]);
Route::get('create/form', '/createForm')->name('supplyAdminCreateForm')->option([
'_alias' => '添加表单',
'_auth' => false,
'_form' => 'supplyAdminCreate',
]);
Route::post('update/:id', '/update')->name('supplyAdminUpdate')->option([
'_alias' => '编辑',
]);
Route::get('update/form/:id', '/updateForm')->name('supplyAdminUpdateForm')->option([
'_alias' => '编辑表单',
'_auth' => false,
'_form' => 'supplyAdminUpdate',
]);
Route::post('password/:id', '/password')->name('supplyAdminPassword')->option([
'_alias' => '修改密码',
]);
Route::get('password/form/:id', '/passwordForm')->name('supplyAdminPasswordForm')->option([
'_alias' => '修改密码表单',
'_auth' => false,
'_form' => 'supplyAdminPassword',
]);
Route::delete('delete/:id', '/delete')->name('supplyAdminDelete')->option([
'_alias' => '删除',
]);
})->prefix('supply.system.admin.SupplyAdmin')->option([
'_path' => '/setting/systemAdmin',
'_auth' => true,
]);
Route::get('system/admin/log', 'admin.system.admin.AdminLog/lst')->name('supplyAdminLog')->option([
'_alias' => '操作日志',
'_path' => '/setting/systemLog',
]);
Route::group('system/admin', function () {
Route::get('edit/form', '/editForm')->name('supplyAdminEditForm')->option([
'_alias' => '修改信息表单',
'_auth' => false,
'_form' => 'supplyAdminEdit',
]);
Route::post('edit', '/edit')->name('supplyAdminEdit')->option([
'_alias' => '修改信息',
]);
Route::get('edit/password/form', '/editPasswordForm')->name('supplyAdminEditPasswordForm')->option([
'_alias' => '修改密码表单',
'_auth' => false,
'_form' => 'supplyAdminEditPassword',
]);
Route::post('edit/password', '/editPassword')->name('supplyAdminEditPassword')->option([
'_alias' => '修改密码',
]);
})->prefix('supply.system.admin.SupplyAdmin')->option([
'_path' => 'self',
'_auth' => true,
]);
})->middleware(AllowOriginMiddleware::class)
->middleware(MerchantTokenMiddleware::class, true)
->middleware(MerchantAuthMiddleware::class)
->middleware(MerchantCheckBaseInfoMiddleware::class)
->middleware(LogMiddleware::class);

Some files were not shown because too many files have changed in this diff Show More