| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 | <?php/** * SettleLogLogic.php  UTF-8 * huosdk_mini_program * * @date    : 2018/8/16 17:07 * * @license 这不是一个自由软件,未经授权不许任何使用和传播。 * @author  : chenbingling <cbl@huosdk.com> * @version : HUOSDK 8.0 */namespace huomp\logic\finance;use huo\model\user\UserModel;use huolib\constant\CommonConst;use huolib\constant\SettleConst;use huomp\model\common\CommonModel;use huomp\model\finance\SettleLogModel;class SettleLogLogic extends CommonModel {    /*添加记录*/    public function addPayLog($data) {        return (new SettleLogModel())->addPayLog($data);    }    protected function getWhere($param = []) {        $_map = [];        if (!empty($param['start_time']) && !empty($param['start_time'])) {            $_map['create_time'] = ['between', [strtotime($param['start_time']),                                                CommonConst::CONST_DAY_SECONDS + strtotime($param['end_time'])]];        } else if (!empty($param['start_time'])) {            $_map['create_time'] = ['gt', strtotime($param['start_time'])];        } else if (!empty($param['end_time'])) {            $_map['create_time'] = ['lt', CommonConst::CONST_DAY_SECONDS + strtotime($param['end_time'])];        }        if (!empty($param['type'])) {            $_map['type'] = $param['type'];        }        if (!empty($param['agent_name'])) {            $_ag_ids = (new UserModel())->getIdsByNickName($param['agent_name']);            $_map['agent_id'] = ['in', $_ag_ids];        }        return $_map;    }    /*获取打款记录*/    public function getMemLogList($param, $page = '1,10', $order = '-create_time') {        $_redata = ['count' => 0, 'list' => []];        $_map = $this->getWhere($param);        $_model = new SettleLogModel();        $_count = $_model->where($_map)->count('id');        if (empty($_count)) {            return $_redata;        }        $_order = $_model->orderFilter($order);        $_file = ['id', 'agent_id', 'order_id', 'amount', 'code', 'type', 'cardholder', 'banknum', 'msg', 'result',                  'query_result',                  'create_time'];        $_list = $_model->with('agent')                        ->where($_map)                        ->field($_file)                        ->order($_order)                        ->page($page)                        ->select();        if (is_object($_list)) {            $_list = $_list->toArray();        }        if (empty($_list)) {            return $_redata;        }        foreach ($_list as $_k => $_v) {            $_list[$_k]['type'] = SettleConst::getTypesMsg($_v['type']);            $_list[$_k]['agent_nickname'] = !empty($_v['agent']['user_nicename']) ? $_v['agent']['user_nicename'] : '';            unset($_list[$_k]['agent']);        }        $_redata['count'] = $_count;        $_redata['list'] = $_list;        return $_redata;    }    /**     * 获取条件下提现人数提现人数     *     * @param array $map     *     * @return int|string     */    public function getSettleCnt($map = []) {        $_model = new SettleLogModel();        $_cnt = $_model->where($map)->group('agent_id')->count();        return $_cnt;    }}
 |