| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- namespace addons\HuijuBill\common\service;
- use addons\HuijuBill\common\enums\SettlementOrderStatusEnum;
- use addons\HuijuBill\common\enums\SettlementTypeEnum;
- use addons\HuijuBill\common\logic\PayApiLogic;
- use common\models\common\MiddleMch;
- use yii\base\Model;
- class SettlementService extends Model
- {
- /**
- * 商户ID
- *
- * @var integer
- */
- public $mall_id;
- /**
- * 錯誤
- *
- * @var string
- */
- public $error;
- /**
- * 获取结算列表
- *
- * @param array $params
- * @return array
- */
- public function getSettlementList($params)
- {
- $mch = MiddleMch::getMch($this->mall_id);
- $service = new PayApiLogic($mch);
- $start_time = !empty($params['data']) ? $params['data'][0] : date('Y-m-d', strtotime('-90day'));
- $end_time = !empty($params['data']) ? $params['data'][1] : date('Y-m-d');
- $page = empty($params['page']) ? 1 : intval($params['page']);
- $data = $service->order_settle_list($start_time, $end_time, $page);
- $list = $data['items'];
- foreach ($list as $k => $v) {
- $list[$k]['order_status_text'] = SettlementOrderStatusEnum::getValue($v['order_status']);
- $list[$k]['type_text'] = SettlementTypeEnum::getValue($v['type']);
- }
- $res['list'] = $list;
- $res['limit'] = 10;
- $res['page_count'] = ceil($data['pageInfo']['total'] / 15);
- $res['current_page'] = $data['pageInfo']['currentPage'];
- return $res;
- }
- }
|