CharCashItem_OutputBox.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. namespace App\Models\Char;
  3. use Illuminate\Database\Eloquent\Factories\HasFactory;
  4. use Illuminate\Database\Eloquent\Model;
  5. use App\Models\Char\CharBase;
  6. class CharCashItem_OutputBox extends Model
  7. {
  8. protected $connection = "Char";
  9. protected $table = "Table_CharCashItem_OutputBox";
  10. protected $primaryKey = "ItemDBIndex";
  11. protected $dates = ["CreateDate", "DeleteDate"];
  12. protected $fillable =
  13. [
  14. "ItemDBIndex",
  15. "Owner",
  16. "Kind",
  17. "RecId",
  18. "Amount",
  19. "strChargeNo",
  20. "Deleted",
  21. "CreateDate",
  22. "DeleteDate",
  23. "GaveCharName",
  24. "Confirm",
  25. "Period",
  26. "Price",
  27. "evPType",
  28. "Comment"
  29. ];
  30. public $timestamps = false;
  31. public static function SENDITEMOUTPUTBOX($request)
  32. {
  33. if ($request['Owner'] == "") {
  34. $chars = CharBase::get();
  35. foreach ($chars as $char) {
  36. if ($char->Online == 1) {
  37. $send = new CharCashItem_OutputBox();
  38. $send->Owner = $char->DBKey;
  39. $send->Kind = $request['Kind'];
  40. $send->RecId = trim(strtolower($request['RecId']));
  41. $send->Amount = $request['Amount'];
  42. $send->strChargeNo = "*";
  43. $send->Deleted = 0;
  44. $send->CreateDate = now();
  45. $send->DeleteDate = now();
  46. $send->GaveCharName = "*";
  47. $send->Confirm = 0;
  48. $send->Period = $request['Period'];
  49. $send->Price = 0;
  50. $send->evPType = $request['evPType'];
  51. $send->Comment = $request['Comment'];
  52. $send->save();
  53. }
  54. }
  55. } else {
  56. $send = new CharCashItem_OutputBox();
  57. $send->Owner = $request['Owner'];
  58. $send->Kind = $request['Kind'];
  59. $send->RecId = trim(strtolower($request['RecId']));
  60. $send->Amount = $request['Amount'];
  61. $send->strChargeNo = "*";
  62. $send->Deleted = 0;
  63. $send->CreateDate = now();
  64. $send->DeleteDate = now();
  65. $send->GaveCharName = "*";
  66. $send->Confirm = 0;
  67. $send->Period = $request['Period'];
  68. $send->Price = 0;
  69. $send->evPType = $request['evPType'];
  70. $send->Comment = $request['Comment'];
  71. $send->save();
  72. }
  73. }
  74. }