更新供销model
This commit is contained in:
parent
98e4e895b9
commit
296ff5027c
@ -15,7 +15,7 @@ namespace app\common\dao\system\supply;
|
||||
|
||||
|
||||
use app\common\dao\BaseDao;
|
||||
use app\common\model\system\merchant\FinancialRecord;
|
||||
use app\common\model\system\supply\FinancialRecord;
|
||||
|
||||
class FinancialRecordDao extends BaseDao
|
||||
{
|
||||
|
@ -15,7 +15,7 @@ namespace app\common\dao\system\supply;
|
||||
|
||||
|
||||
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\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
@ -25,7 +25,7 @@ use think\Model;
|
||||
|
||||
/**
|
||||
* Class SupplyAdminDao
|
||||
* @package app\common\dao\system\merchant
|
||||
* @package app\common\dao\system\supply
|
||||
* @author xaboy
|
||||
* @day 2020-04-17
|
||||
*/
|
||||
@ -39,7 +39,7 @@ class SupplyAdminDao extends BaseDao
|
||||
*/
|
||||
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)
|
||||
{
|
||||
$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) {
|
||||
getModelTime($query, $where['date']);
|
||||
});
|
||||
@ -78,7 +78,7 @@ class SupplyAdminDao extends BaseDao
|
||||
*/
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
return MerchantAdmin::getInstance()->where('account', $account)
|
||||
return SupplyAdmin::getInstance()->where('account', $account)
|
||||
->where('is_del', 0)->where('mer_id', $merId)
|
||||
->field(['account', 'pwd', 'real_name', 'login_count', 'merchant_admin_id', 'status', 'mer_id'])
|
||||
->find();
|
||||
@ -124,7 +124,7 @@ class SupplyAdminDao extends BaseDao
|
||||
*/
|
||||
public function accountByTopAdmin(string $account)
|
||||
{
|
||||
return MerchantAdmin::getInstance()->where('account', $account)
|
||||
return SupplyAdmin::getInstance()->where('account', $account)
|
||||
->where('is_del', 0)->where('level', 0)
|
||||
->field(['account', 'pwd', 'real_name', 'login_count', 'merchant_admin_id', 'status', 'mer_id'])
|
||||
->find();
|
||||
@ -138,7 +138,7 @@ class SupplyAdminDao extends BaseDao
|
||||
*/
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
$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 (!is_null($level)) $query->where('level', $level);
|
||||
return $query->count() > 0;
|
||||
@ -183,7 +183,7 @@ class SupplyAdminDao extends BaseDao
|
||||
*/
|
||||
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);
|
||||
return $query->count() > 0;
|
||||
}
|
||||
@ -196,7 +196,7 @@ class SupplyAdminDao extends BaseDao
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
@ -208,11 +208,11 @@ class SupplyAdminDao extends BaseDao
|
||||
*/
|
||||
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)
|
||||
{
|
||||
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\')')]);
|
||||
}
|
||||
}
|
||||
|
@ -14,13 +14,13 @@
|
||||
namespace app\common\dao\system\supply;
|
||||
|
||||
use app\common\dao\BaseDao;
|
||||
use app\common\model\system\merchant\MerchantApplyments;
|
||||
use app\common\model\system\supply\SupplyApplyments;
|
||||
|
||||
class SupplyAppymentsDao extends BaseDao
|
||||
{
|
||||
protected function getModel(): string
|
||||
{
|
||||
return MerchantApplyments::class;
|
||||
return SupplyApplyments::class;
|
||||
}
|
||||
|
||||
public function search(array $where)
|
||||
|
@ -16,13 +16,13 @@ namespace app\common\dao\system\supply;
|
||||
|
||||
use app\common\dao\BaseDao;
|
||||
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\facade\Db;
|
||||
|
||||
/**
|
||||
* Class MerchantCategoryDao
|
||||
* @package app\common\dao\system\merchant
|
||||
* Class SupplyCategoryDao
|
||||
* @package app\common\dao\system\supply
|
||||
* @author xaboy
|
||||
* @day 2020-05-06
|
||||
*/
|
||||
@ -36,7 +36,7 @@ class SupplyCategoryDao extends BaseDao
|
||||
*/
|
||||
protected function getModel(): string
|
||||
{
|
||||
return MerchantCategory::class;
|
||||
return SupplyCategory::class;
|
||||
}
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ class SupplyCategoryDao extends BaseDao
|
||||
*/
|
||||
public function search(array $where = [])
|
||||
{
|
||||
return MerchantCategory::getDB();
|
||||
return SupplyCategory::getDB();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -58,7 +58,7 @@ class SupplyCategoryDao extends BaseDao
|
||||
*/
|
||||
public function allOptions()
|
||||
{
|
||||
$data = MerchantCategory::getDB()->column('category_name', 'merchant_category_id');
|
||||
$data = SupplyCategory::getDB()->column('category_name', 'merchant_category_id');
|
||||
$options = [];
|
||||
foreach ($data as $value => $label) {
|
||||
$options[] = compact('value', 'label');
|
||||
@ -68,7 +68,7 @@ class SupplyCategoryDao extends BaseDao
|
||||
|
||||
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'))
|
||||
->when($date, function ($query, $date) {
|
||||
getModelTime($query, $date, 'C.pay_time');
|
||||
@ -77,6 +77,6 @@ class SupplyCategoryDao extends BaseDao
|
||||
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ namespace app\common\dao\system\supply;
|
||||
|
||||
|
||||
use app\common\dao\BaseDao;
|
||||
use app\common\model\system\merchant\Merchant;
|
||||
use app\common\model\system\supply\Supply;
|
||||
use crmeb\services\VicWordService;
|
||||
use think\db\BaseQuery;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
@ -34,7 +34,7 @@ class SupplyDao extends BaseDao
|
||||
*/
|
||||
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)
|
||||
{
|
||||
$query = Merchant::getDB()
|
||||
$query = Supply::getDB()
|
||||
->when($is_del !== null, function ($query) use ($is_del) {
|
||||
$query->where('is_del', $is_del);
|
||||
})
|
||||
@ -141,7 +141,7 @@ class SupplyDao extends BaseDao
|
||||
*/
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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);
|
||||
})->count();
|
||||
}
|
||||
@ -198,7 +198,7 @@ class SupplyDao extends BaseDao
|
||||
*/
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
|
@ -14,13 +14,13 @@
|
||||
namespace app\common\dao\system\supply;
|
||||
|
||||
use app\common\dao\BaseDao;
|
||||
use app\common\model\system\merchant\MerchantIntention;
|
||||
use app\common\model\system\supply\SupplyIntention;
|
||||
|
||||
class SupplyIntentionDao extends BaseDao
|
||||
{
|
||||
protected function getModel(): string
|
||||
{
|
||||
return MerchantIntention::class;
|
||||
return SupplyIntention::class;
|
||||
}
|
||||
|
||||
public function search(array $where)
|
||||
|
@ -15,19 +15,19 @@ namespace app\common\dao\system\supply;
|
||||
|
||||
use app\common\dao\BaseDao;
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\model\system\merchant\MerchantType;
|
||||
use app\common\model\system\supply\SupplyType;
|
||||
|
||||
class SupplyTypeDao extends BaseDao
|
||||
{
|
||||
|
||||
protected function getModel(): string
|
||||
{
|
||||
return MerchantType::class;
|
||||
return SupplyType::class;
|
||||
}
|
||||
|
||||
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){
|
||||
$query->where('mer_type_id',$where['mer_type_id']);
|
||||
});
|
||||
@ -35,7 +35,7 @@ class SupplyTypeDao extends BaseDao
|
||||
|
||||
public function getOptions()
|
||||
{
|
||||
$data = MerchantType::getDB()->column('type_name', 'mer_type_id');
|
||||
$data = SupplyType::getDB()->column('type_name', 'mer_type_id');
|
||||
$options = [];
|
||||
foreach ($data as $value => $label) {
|
||||
$options[] = compact('value', 'label');
|
||||
@ -45,7 +45,7 @@ class SupplyTypeDao extends BaseDao
|
||||
|
||||
public function getMargin()
|
||||
{
|
||||
$data = MerchantType::getDB()->column('margin,is_margin', 'mer_type_id');
|
||||
$data = SupplyType::getDB()->column('margin,is_margin', 'mer_type_id');
|
||||
$options = [];
|
||||
foreach ($data as $value => $item) {
|
||||
if ($item['is_margin'] == 1) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user