uo_phone_push.sru 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. $PBExportHeader$uo_phone_push.sru
  2. forward
  3. global type uo_phone_push from nonvisualobject
  4. end type
  5. end forward
  6. global type uo_phone_push from nonvisualobject
  7. end type
  8. global uo_phone_push uo_phone_push
  9. forward prototypes
  10. public function integer uf_add (long arg_empid[], string arg_title, string arg_content, string arg_reltype, string arg_relid, ref long arg_rt_pushid, ref string arg_msg, boolean arg_if_commit)
  11. public function integer uf_add (long arg_empid[], string arg_title, string arg_content, ref long arg_rt_pushid, ref string arg_msg, boolean arg_if_commit)
  12. end prototypes
  13. public function integer uf_add (long arg_empid[], string arg_title, string arg_content, string arg_reltype, string arg_relid, ref long arg_rt_pushid, ref string arg_msg, boolean arg_if_commit);Int rslt = 1
  14. arg_rt_pushid = 0
  15. IF lena(arg_title) > 255 THEN
  16. arg_title = mida(arg_title, 1, 252) + '...'
  17. END IF
  18. IF lena(arg_content) > 255 THEN
  19. arg_content = mida(arg_content, 1, 252) + '...'
  20. END IF
  21. String ls_empids = ''
  22. Long i
  23. Long ifphone
  24. FOR i = 1 To UpperBound(arg_empid)
  25. SELECT ifphone Into :ifphone From u_user Where empid = :arg_empid[i];
  26. IF sqlca.SQLCode <> 0 THEN
  27. ifphone = 0
  28. // rslt = 0
  29. // arg_msg = '查询用户是否使用手机APP失败,' + sqlca.SQLErrText
  30. // GOTO ext
  31. END IF
  32. IF ifphone = 1 THEN
  33. IF ls_empids = '' THEN
  34. ls_empids = String(arg_empid[i])
  35. ELSE
  36. ls_empids += ',' + String(arg_empid[i])
  37. END IF
  38. END IF
  39. NEXT
  40. Long ll_newid
  41. IF ls_empids <> '' THEN
  42. ll_newid = f_sys_scidentity(0,"u_phone_push","pushid",arg_msg,True,id_sqlca)
  43. IF ll_newid <= 0 THEN
  44. rslt = 0
  45. arg_msg = '获取pushid失败,' + arg_msg
  46. GOTO ext
  47. END IF
  48. INSERT Into u_phone_push(pushid, empids, Title, tcontent, reltype, relid) Values(:ll_newid, :ls_empids, :arg_title, :arg_content, :arg_reltype, :arg_relid);
  49. IF sqlca.SQLCode <> 0 THEN
  50. rslt = 0
  51. arg_msg = '插入推送消息表失败,' + sqlca.SQLErrText
  52. GOTO ext
  53. END IF
  54. arg_rt_pushid = ll_newid
  55. END IF
  56. ext:
  57. IF arg_if_commit THEN
  58. IF rslt = 1 THEN
  59. COMMIT;
  60. ELSE
  61. ROLLBACK;
  62. END IF
  63. END IF
  64. RETURN rslt
  65. end function
  66. public function integer uf_add (long arg_empid[], string arg_title, string arg_content, ref long arg_rt_pushid, ref string arg_msg, boolean arg_if_commit);return uf_add(arg_empid, arg_title, arg_content, '', '', arg_rt_pushid, arg_msg, arg_if_commit)
  67. end function
  68. on uo_phone_push.create
  69. call super::create
  70. TriggerEvent( this, "constructor" )
  71. end on
  72. on uo_phone_push.destroy
  73. TriggerEvent( this, "destructor" )
  74. call super::destroy
  75. end on