Files
addons
extend
hyhproject
admin
app
common
behavior
common
conf
exception
model
Addons.php
Ads.php
Aliyunoss.php
Areas.php
Auth.php
AuthFamily.php
Banks.php
Base.php
Brands.php
Carts.php
CashConfigs.php
CashDraws.php
ChargeItems.php
CompanyBank.php
Ectwallet.php
Express.php
Favorites.php
Goods.php
GoodsAppraises.php
GoodsCats.php
GoodsConsult.php
GoodsVirtuals.php
HomeMenus.php
Hooks.php
Informs.php
Invoices.php
LogMoneys.php
LogPayParams.php
LogPays.php
LogSms.php
MessageQueues.php
Messages.php
OrderComplains.php
OrderRefunds.php
Orders.php
Payments.php
Position.php
Settlements.php
ShopCats.php
ShopExtras.php
Shopping.php
Shops.php
SysConfigs.php
SysSummary.php
Systems.php
Table.php
Tags.php
UserAddress.php
UserReward.php
UserScores.php
UserTrees.php
UserVouchers.php
Users.php
taglib
validate
home
home2
mobile2
wechat2
.htaccess
command.php
mobile
oss
static
thinkphp
upload
vendor
wxtmp
.gitignore
.htaccess
.user.ini
404.html
admin.php
cash.lock
demo.php
get_startup.php
get_version.php
get_version_new.php
index.html
index.php
reg.lock
robots.txt
qlg.tsgz.moe/hyhproject/common/model/CashConfigs.php
2019-09-06 23:53:10 +08:00

92 lines
3.2 KiB
PHP
Executable File

<?php
namespace wstmart\common\model;
/**
* ============================================================================
* 提现账号业务处理器
*/
class CashConfigs extends Base{
/**
* 获取列表
*/
public function pageQuery($targetType,$targetId){
$type = (int)input('post.type',-1);
$where = [];
$where['targetType'] = (int)$targetType;
$where['targetId'] = (int)$targetId;
$where['c.dataFlag'] = 1;
if(in_array($type,[0,1]))$where['moneyType'] = $type;
$page = $this->alias('c')->join('__BANKS__ b','c.accTargetId=b.bankId')->where($where)->field('b.bankName,c.*')->order('c.id desc')->paginate()->toArray();
if(count($page['Rows'])>0){
foreach($page['Rows'] as $key => $v){
$areas = model('areas')->getParentNames($v['accAreaId']);
$page['Rows'][$key]['areaName'] = implode('',$areas);
}
}
return $page;
}
/**
* 获取列表
*/
public function listQuery($targetType,$targetId){
$where = [];
$where['targetType'] = (int)$targetType;
$where['targetId'] = (int)$targetId;
$where['dataFlag'] = 1;
return $this->where($where)->field('id,accNo,accUser')->select();
}
/**
* 获取资料
*/
public function getById($id){
$config = $this->get($id);
$areas = model('areas')->getParentIs($config['accAreaId']);
$config['accAreaIdPath'] = implode('_',$areas)."_";
return $config;
}
/**
* 新增卡号
*/
public function add(){
$data = input('post.');
$data['targetType'] = 0;
$data['targetId'] = (int)session('WST_USER.userId');
$data['accType'] = 3;
$data['userId'] = (int)session('WST_USER.userId');
$data['createTime'] = date('Y-m-d H:i:s');
WSTUnset($data,'id');
$result = $this->validate('CashConfigs.add')->allowField(true)->save($data);
if(false !== $result){
return WSTReturn("新增成功", 1,['id'=>$this->id]);
}else{
return WSTReturn($this->getError(),-1);
}
}
/**
* 编辑卡号
*/
public function edit(){
$id = (int)input('id');
$data = input('post.');
$userId = (int)session('WST_USER.userId');
WSTUnset($data,'id,targetType,targetId,accType,createTime');
$result = $this->validate('CashConfigs.edit')->allowField(true)->save($data,['id'=>$id,'targetId'=>$userId]);
if(false !== $result){
return WSTReturn("编辑成功", 1);
}else{
return WSTReturn($this->getError(),-1);
}
}
/**
* 删除提现账号
*/
public function del(){
$object = $this->get((int)input('id'));
$object->dataFlag = -1;
$result = $object->save();
if(false !== $result){
return WSTReturn('操作成功',1);
}
return WSTReturn('操作失败',-1);
}
}