order('sort')->select(); return ['lists' => $lists, 'count' => $count]; } /** * Notes: 详情 * @param $pay_code * @author 段誉(2021/5/7 18:15) * @return array|\think\Model|null * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public static function info($pay_code) { return Pay::where(['code' => $pay_code])->find(); } /** * Notes: 余额 * @param $post * @author 段誉(2021/5/7 18:15) * @return Pay */ public static function editBalance($post) { return Pay::where('code', 'balance')->update([ 'short_name' => $post['short_name'], 'image' => UrlServer::setFileUrl($post['image']) ?? '', 'status' => $post['status'], 'sort' => $post['sort'] ?? 0, ]); } /** * Notes: 微信 * @param $post * @author 段誉(2021/5/7 18:16) * @return Pay */ public static function editWechat($post) { $data = [ 'short_name' => $post['short_name'], 'image' => UrlServer::setFileUrl($post['image']) ?? '', 'status' => $post['status'], 'sort' => $post['sort'] ?? 0, 'config' => [ 'pay_sign_key' => $post['pay_sign_key'], 'mch_id' => $post['mch_id'], 'apiclient_cert' => $post['apiclient_cert'], 'apiclient_key' => $post['apiclient_key'] ] ]; return Pay::where('code', 'wechat')->update($data); } /** * Notes: 支付宝 * @param $post * @author 段誉(2021/5/7 18:16) * @return Pay */ public static function editAlipay($post) { $data = [ 'short_name' => $post['short_name'], 'image' => UrlServer::setFileUrl($post['image']) ?? '', 'status' => $post['status'], 'sort' => $post['sort'] ?? 0, 'config' => [ 'app_id' => $post['app_id'], 'private_key' => $post['private_key'],//应用私钥 'ali_public_key' => $post['ali_public_key']//支付宝公钥 ] ]; return Pay::where('code', 'alipay')->update($data); } }