74 lines
2.1 KiB
PHP
74 lines
2.1 KiB
PHP
<?php
|
|
/**
|
|
* SaaSMall商城系统 - 团队十年电商经验汇集巨献!
|
|
* =========================================================
|
|
* Copy right 2019-2029 成都SAAS云科技有限公司, 保留所有权利。
|
|
* ----------------------------------------------
|
|
* 官方网址: https://www.gobuysaas.com
|
|
* =========================================================
|
|
*/
|
|
|
|
namespace addon\saas\model;
|
|
|
|
use app\model\BaseModel;
|
|
use app\model\system\Cron;
|
|
use think\facade\Db;
|
|
|
|
/**
|
|
* 区域经理
|
|
*/
|
|
class RegionAccount extends BaseModel
|
|
{
|
|
public $type = [
|
|
'withdraw' => '提现',
|
|
'order' => '订单结算',
|
|
];
|
|
|
|
/**
|
|
* 添加账户流水
|
|
* @param $manage_id
|
|
* @param string $type
|
|
* @param $money
|
|
* @param $relate_id
|
|
* @param $site_id
|
|
* @return array
|
|
*/
|
|
public function addAccount($manage_id, $type, $money, $relate_id,$site_id)
|
|
{
|
|
$account_no = date('YmdHi') . rand(1000, 9999);
|
|
$data = array(
|
|
'manage_id' => $manage_id,
|
|
'site_id' => $site_id,
|
|
'account_no' => $account_no,
|
|
'money' => $money,
|
|
'type' => $type,
|
|
'type_name' => $this->type[$type],
|
|
'relate_id' => $relate_id,
|
|
'create_time' => time(),
|
|
);
|
|
$res = model('region_account')->add($data);
|
|
model('region_manage')->update([
|
|
'total_commission' => Db::raw('total_commission+' . $money),
|
|
'account' => Db::raw('account+' . $money),
|
|
'total_order_num' => Db::raw('total_order_num+' . 1),
|
|
], [
|
|
'id' => $manage_id
|
|
]);
|
|
return $this->success($res);
|
|
}
|
|
|
|
/**
|
|
* 获取商账户流水分页列表
|
|
* @param array $condition
|
|
* @param number $page
|
|
* @param string $page_size
|
|
* @param string $order
|
|
* @param string $field
|
|
*/
|
|
public function getAccountPageList($condition = [], $page = 1, $page_size = PAGE_LIST_ROWS, $order = 'create_time desc', $field = '*')
|
|
{
|
|
$list = model('region_account')->pageList($condition, $field, $order, $page, $page_size);
|
|
return $this->success($list);
|
|
}
|
|
}
|