链街Dcat后台
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.

44 lines
1.1 KiB

  1. <?php
  2. namespace App\Admin\Repositories;
  3. use Dcat\Admin\Grid;
  4. use Dcat\Admin\Repositories\Repository;
  5. use Illuminate\Pagination\LengthAwarePaginator;
  6. use SimpleSSDB;
  7. class CouponTie extends Repository{
  8. public function getPrimaryKeyColumn()
  9. {
  10. return '_id';
  11. }
  12. public function get(Grid\Model $model)
  13. {
  14. $host = env('SSDB_HOST');
  15. $port = env('SSDB_PORT');
  16. try{
  17. $ssdb = new SimpleSSDB($host, $port);
  18. $ssdb->auth(env('SSDB_AUTH'));
  19. }catch(\Exception $e){
  20. dd($e);
  21. }
  22. $activity = $ssdb->get('coupon_rebate_activity');
  23. $forward = $ssdb->hgetall('coupon_rebate_forward_'.$activity);
  24. $forward = is_array($forward) ? implode(' , ',$forward) : $forward ;
  25. $repay = $ssdb->get('coupon_rebate_repay_'.$activity);
  26. return $model->makePaginator(
  27. 1,
  28. [
  29. [
  30. 'id'=>1,
  31. 'activity'=>$activity,
  32. 'forward'=>$forward,
  33. 'repay' => $repay
  34. ],
  35. ],
  36. );
  37. }
  38. }