| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 | <?php/** * Created by PhpStorm. * User: tandunzhao * Date: 2017/12/2 * Time: 下午3:54 */namespace App\Modules\Finance\Services;use App\Modules\Finance\Models\FinancialStat;class FinancialStatService{    /**     * 根据渠道ID获取FinancialStat     * @param $channelId     * @return mixed     */    public static function getFinancialStatSingle($channelId) {        $financialStat = FinancialStat::getByDistributionChannel($channelId);        return $financialStat;    }    /**     * 更具提现金额修改 FinancialStat     * @param $channelId 渠道ID     * @param $money 提现金额额     * @return mixed     */    public static function updateFinancialStatByWithdraw($channelId, $money) {        $financialStat = self::getFinancialStatSingle($channelId);        if(!empty($financialStat)) {            $enable_amount = $financialStat['enable_withdrawal_amount'] - $money;            $withdraw_pending_amount = $financialStat['withdraw_pending_amount'] + $money;            //修改可提现总额            $financialStat['enable_withdrawal_amount'] = $enable_amount;            //修改提现中金额            $financialStat['withdraw_pending_amount'] = $withdraw_pending_amount;            //修改最近提现金额            $dataFinancialStat['latest_withdrawal_amount'] = $money;            //修改提现时间            $financialStat['latest_withdraw_time'] = date('Y-m-d H:i:s');            $financialStat->save();        }        return $financialStat;    }    /**     * 获取账号信息列表     * @param $params[]     *                  channel_id:渠道ID 可选     *                  channel_name:渠道名称 可选     *                  person_in_charge_name: 渠道负责人姓名 可选     *                  search_name: 搜索名称 可选     *                  ac_start_time:开始时间 可选     *                  ac_end_time:结束时间 可选     *                  is_frozen:冻结  0; -1 可选     *                  frozen_start_time:冻结开始时间 可选     *                  frozen_end_time:冻结结束时间  可选     *                  is_company 0:对私, 1:对公司     * @return mixed     */    public static function getFrozenFinancialStatListParam($params=[]) {        return FinancialStat::getFrozenFinancialStatListParam($params);    }    /**     * 获取账号信息列表     * @param $params[]     *                  channel_id:渠道ID 可选     *                  channel_name:渠道名称 可选     *                  person_in_charge_name: 渠道负责人姓名 可选     *                  search_name: 搜索名称 可选     *                  ac_start_time:开始时间 可选     *                  ac_end_time:结束时间 可选     *                  is_frozen:冻结  0; -1 可选     *                  frozen_start_time:冻结开始时间 可选     *                  frozen_end_time:冻结结束时间  可选     * @return mixed     */    public static function getFrozenFinancialStatPriceListDetail($params=[]) {        return FinancialStat::getFrozenFinancialStatPriceListDetail($params);    }}
 |