MoneyBuyMatch.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: scstf
  5. * Date: 2018/9/28
  6. * Time: 20:05
  7. */
  8. namespace App\Models;
  9. use Illuminate\Database\Eloquent\Model;
  10. class MoneyBuyMatch extends Model
  11. {
  12. protected $table='money_buy_match';
  13. public function getByAttrs($where,$orderArray=[]){
  14. if (empty($order)){
  15. $datas = $this->where($where)->get();
  16. }else{
  17. $datas = $this->where($where)->orderby($orderArray['orderby'],$orderArray['order'])->get();
  18. }
  19. return $datas ;
  20. }
  21. //赛事下所有下注单式下单
  22. function allsimplexorder($ssid){
  23. //单式下单
  24. $where = array();
  25. $where[] = array('money_buy_match.match_id', '=', $ssid);
  26. $where[] = array('money_buy_match.bet_type', '=', 1);
  27. $data = $this->join('money_buy_simplex','money_buy_match.batch_id','=','money_buy_simplex.batch_id')->select('money_buy_simplex.order_id','money_buy_simplex.money','money_buy_simplex.account_identity','money_buy_simplex.info_identity','money_buy_simplex.match_id')->where($where)->get()->toArray();
  28. return $data;
  29. }
  30. //赛事下所有下注串式下单
  31. function allstrorder($ssid){
  32. //串式下单
  33. $where = array();
  34. $where[] = array('money_buy_match.match_id', '=', $ssid);
  35. $where[] = array('money_buy_match.bet_type', '=', 2);
  36. $data = $this->join('money_buy_str','money_buy_match.batch_id','=','money_buy_str.batch_id')->select('money_buy_str.order_id')->where($where)->get()->toArray();
  37. return $data;
  38. }
  39. //修改串式下注状态
  40. function updatast($match_id){
  41. $the = array(
  42. 'updated_at'=>date('Y-m-d H:i:s'),
  43. 'result'=>2,
  44. );
  45. $where = array(
  46. 'match_id'=>$match_id,
  47. 'bet_type'=>2,
  48. );
  49. $res = $this->where($where)->update($the);
  50. if (!$res) {
  51. return -4010000102; //更新失败
  52. }
  53. return $res;
  54. }
  55. }