You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.1 KiB
45 lines
1.1 KiB
<?php
|
|
namespace App\Admin\Repositories;
|
|
|
|
use Dcat\Admin\Grid;
|
|
use Dcat\Admin\Repositories\Repository;
|
|
use Illuminate\Pagination\LengthAwarePaginator;
|
|
use SimpleSSDB;
|
|
|
|
class CouponTie extends Repository{
|
|
|
|
public function getPrimaryKeyColumn()
|
|
{
|
|
return '_id';
|
|
}
|
|
|
|
public function get(Grid\Model $model)
|
|
{
|
|
$host = env('SSDB_HOST');
|
|
$port = env('SSDB_PORT');
|
|
try{
|
|
$ssdb = new SimpleSSDB($host, $port);
|
|
$ssdb->auth(env('SSDB_AUTH'));
|
|
}catch(\Exception $e){
|
|
dd($e);
|
|
}
|
|
|
|
$activity = $ssdb->get('coupon_rebate_activity');
|
|
$forward = $ssdb->hgetall('coupon_rebate_forward_'.$activity);
|
|
$forward = is_array($forward) ? implode(' , ',$forward) : $forward ;
|
|
$repay = $ssdb->get('coupon_rebate_repay_'.$activity);
|
|
|
|
return $model->makePaginator(
|
|
1,
|
|
[
|
|
[
|
|
'id'=>1,
|
|
'activity'=>$activity,
|
|
'forward'=>$forward,
|
|
'repay' => $repay
|
|
],
|
|
],
|
|
);
|
|
}
|
|
|
|
}
|